I want to install some yii2 extension and want to use them in yii2 framework. While using Composer I am getting Error.
Also I've tried manually adding extension and adding it's content in composer.json still nothing works.
Some some of command include composer.phar file name and I don't have this file in my main project repository. I tried manually adding composer.phar using composer command but still it didn't run.
When I run this command I got error.
composer require dmstr/yii2-adminlte-asset "^2.1"
I got this error
Cannot create cache directory /home/kaushalendra/.composer/cache /repo/https---asset-packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/kaushalendra/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/kaushalendra/.composer/cache/files/, or directory is not writable. Proceeding without cache
./composer.json has been updated
Cannot create cache directory /home/kaushalendra/.composer/cache /repo/https---asset-packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/kaushalendra/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/kaushalendra/.composer/cache/files/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages .
Problem 1- codeception/base 2.5.6 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- codeception/base 2.5.6 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- codeception/base 2.5.6 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- Installation request for codeception/base (locked at 2.5.6, required as ^2.4.0) -> satisfiable by codeception/base[2.5.6].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.3/cli/php.ini
- /etc/php/7.3/cli/conf.d/10-opcache.ini
- /etc/php/7.3/cli/conf.d/10-pdo.ini
- /etc/php/7.3/cli/conf.d/20-calendar.ini
- /etc/php/7.3/cli/conf.d/20-ctype.ini
- /etc/php/7.3/cli/conf.d/20-exif.ini
- /etc/php/7.3/cli/conf.d/20-fileinfo.ini
- /etc/php/7.3/cli/conf.d/20-ftp.ini
- /etc/php/7.3/cli/conf.d/20-gettext.ini
- /etc/php/7.3/cli/conf.d/20-iconv.ini
- /etc/php/7.3/cli/conf.d/20-json.ini
- /etc/php/7.3/cli/conf.d/20-phar.ini
- /etc/php/7.3/cli/conf.d/20-posix.ini
- /etc/php/7.3/cli/conf.d/20-readline.ini
- /etc/php/7.3/cli/conf.d/20-shmop.ini
- /etc/php/7.3/cli/conf.d/20-sockets.ini
- /etc/php/7.3/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.3/cli/conf.d/20-sysvsem.ini
- /etc/php/7.3/cli/conf.d/20-sysvshm.ini
- /etc/php/7.3/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
I've seen somewhere that using this command it will work but getting this error.
composer global require "fxp/composer-asset-plugin:1.0.0-beta4"
and got this error
[ErrorException]
file_put_contents(./composer.json): failed to open stream: Permission denied
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...`
Use the following command to remove the permission warning and to make sure your user has permissions on the global composer folder.
sudo chown -R kaushalendra:<YOUR_GROUP> /home/kaushalendra/.composer
Note: to lookup which group your user belongs to
groups kaushalendra
For me, it shows the following groups
omeraslam : omeraslam sudo www-data docker
after : all are the groups my user is assigned i can use omeraslam as username and omeraslam as group so for me the command will be sudo chown -R omeraslam:omeraslam /home/kaushalendra/.composer
Then run the following command on terminal
sudo apt-get install php-curl
Then restart apache
sudo service apache2 restart
Apparently, you don't have permissions to write to ./composer.json
You have 2 ways to fix this. Either give write permissions to the user or the group to that user by running chmod XXX composer.json or you can change the owner of the file to the user which composer is using(He probably has those permissions already).
The XXX above should be numbers. You can read here what those numbers are supposed to be, but you probably want something like a 660 or a 770.
Some people might use 777 to fix this issue, but this should !!NOT!! be used, as you do not want others to access files, unless they really need to.
You can change the owner of the file by using chown. It should look something like chown user:group composer.json.
Please, let me know if there is something that you do not understand and I will clarify, as I know it is hard to understand permissions as a new linux user.
Please note, that this is only for the last error, but handling the other errors is similar. You just need to give the user, which composer is using the right permissions for the right files and/or folders. You can use -R flag for handling directories.
Related
I am working on a project and tried to install firebase package using:
composer require kreait/laravel-firebase
But it returns different errors:
Using version ^4.1 for kreait/laravel-firebase
./composer.json has been updated
Running composer update kreait/laravel-firebase
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- lcobucci/jwt[4.1.5, ..., 4.2.x-dev] require ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension.
- kreait/laravel-firebase 4.1.0 requires kreait/firebase-php ^6.0 -> satisfiable by kreait/firebase-php[6.0.0, ..., 6.x-dev].
- kreait/firebase-php[6.0.0, ..., 6.x-dev] require lcobucci/jwt ^4.1 -> satisfiable by lcobucci/jwt[4.1.0, ..., 4.2.x-dev].
- Root composer.json requires kreait/laravel-firebase ^4.1 -> satisfiable by kreait/laravel-firebase[4.1.0].
To enable extensions, verify that they are enabled in your .ini files:
- D:\xampp\php\php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-sodium` to temporarily ignore these required extensions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require kreait/laravel-firebase:*" to figure out if any version is installable, or "composer require kreait/laravel-firebase:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
How can i fix this problem?. Is there any solution for this?
You need to install/activate sodium goto, D:\xampp\php\ and open file php.ini.
Now search for sodium
You will see ;extension=sodium
Remove semi colon ; and save file.
Now reload apache, and run the composer again.
For me, I just follow this steps.
step 1.
At first, You need to install/activate sodium goto D:\xampp\php\ and open file php.ini.
Now search for sodium
You will see ;extension=sodium
Remove semi colon ; and save file.
Now reload apache, and run the composer again.
Step 2.
Delete composer.lock file
composer require kreait/laravel-firebase --with-all-dependencies
The answer by Murad Ali worked for me. The only change was I accessed the php.ini file via Xamp the windows app. To edit go to config then select php.ini from the list and edit from there. Scroll to Line 953
the php.ini file
xamp server screen and
After a lot of effort I finally managed to get my composer (with drush) working with Drupal 8.5.3
However I would like to update Drupal to latest version with composer.
Updating composer with sudo doesnt gives me errors but doesnt update my Drupal.
I used this command from my project dir;
sudo composer update drush/drush --with-dependencies
I read that it's bad practice to use sudo for composer and because it doesnt update my Drupal
I try using composer update without sudo.
First I got some warnings that cache could not be used. Because they're only warnings I ignored them.
After some time it sees 11 updates and right after that I got a big red errormessage;
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 11 updates, 0 removals
[RuntimeException]
/path-to-my-site/drupal-composer-build/vendor/symfony/polyfill-ctype does not exist and could not be created.
I then tried the sollution in RuntimeException] vendor does not exist and could not be created
So I did;
Add your user in the www-data group (this action require you to logout and login again)
sudo usermod -a -G www-data `whoami`
Give these permissions to your project
sudo chown -R www-data:www-data /var/www/<project>
sudo chmod -R 774 /var/www/<project>
I skipped the 2nd part that gives rights to /var/www because I'm on a shared server without root userrights.
I got the following message;
No composer.json in current directory, do you want to use the one at /path-to-site? [Y,n]? y
after that got some cache warnings again and the following question;
Cannot create cache directory /home/maikel/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/maikel/.composer/cache/files/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/maikel/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 6 updates, 0 removals
- Updating symfony/event-dispatcher (v3.4.14 => v3.4.15):
Update failed (Could not delete /path-to-site/vendor/symfony/event-dispatcher/GenericEvent.php: )
Would you like to try reinstalling the package instead [yes]? y
I anwered yes again, then;
- Removing symfony/event-dispatcher (v3.4.14)
[RuntimeException]
Could not delete /path-to-site/vendor/symfony/event-dispatcher/GenericEvent.php:
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev]
[--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-
progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies]
[-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-
authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-
stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--]
[<packages>]...
My two questions are;
Do I really really need composer (with drush)? I rather drop composer
or Drupal alltogether
If I really need it to properly manage updates in the future, how can
I configure composer to update, do I need a global configuration?
Thanks a lot in advance
If I can update this question with more information/config files please let me know, I'll gladly do, I honestly don't know where to begin.
For user profile I want to create profile picture, but when I write composer require intervention/image in terminal I get this error:
- intervention/image 2.4.1 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
- intervention/image 2.4.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
- Installation request for intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1].
To enable extensions, verify that they are enabled in your .ini files:
- C:\AppServ\php5\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
Read what Composer suggests. Just install the PHP extenion fileinfo. Check the installation guide on PHP.net: http://php.net/manual/en/fileinfo.installation.php
Make sure you have the php_fileinfo.dll in your php/ext folder. Then uncomment this line in your php.ini
extension=php_fileinfo.dll
I am trying to install a push-notification library for codeigniter using composer fromhere .But when i do run a command it throws this error -> Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for wrep/notificato ^1.2 -> satisfiable by wrep/notificato[1.2.0].
- wrep/notificato 1.2.0 requires ext-sockets * -> the requested PHP extension sockets is missing from your system.
To enable extensions, verify that they are enabled in your .ini files:
- E:\xampp\php\php.ini
You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
I also did commented the php.ini extension=php_intl.dll and also its the same error occuring. How can i solve this?
I have been trying to update / install with composer on my windows7 64 bit machine. But lately I am getting this errors:
$ php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev)
- Installing zendframework/zendxml (dev-master 559b34f)
Cloning 559b34f426d33a11c3db118e00ce14bb8dc64e5f
Failed to download zendframework/zendxml from source: RecursiveDirectoryIterator
::__construct(C:\wamp\www\projects\vendor\zendframework\zendxml,C:\wamp\www\projects\vendor\zendframework\zendxml): The system cannot find the path specified. (
code: 3)
Now trying to download from dist
- Installing zendframework/zendxml (dev-master 559b34f)
Downloading: 100%
[UnexpectedValueException]
RecursiveDirectoryIterator::__construct(C:\wamp\www\projects\vendor/zendfra
mework/zendxml,C:\wamp\www\projects\vendor/zendframework/zendxml): The syst
em cannot find the path specified. (code: 3)
I have tried to remove the vendor directory as well as empty the composer cache but this didn't solve the issue.
Any suggestions?
My problem was that I moved a directory which enabled colors in cmd.exe. Now the directory was not linked properly anymore.
Check out https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- and also check for invalid paths.
Maybe a write permisions error in the vendor's folder.
Stop Apache and delete the folder /vendor/zendframework and run again composer install.