command composer Install give error failed to extract - laravel

I'm using ubuntu server & trying to run composer install command in my Laravel project. But it give error
Failed to extract brick/math: (2) '/usr/bin/unzip' -qq '/var/www/html/xtendanceweb/vendor/composer/tmp-9f6f68323bcc502e257e735e3f7dcac8' -d '/var/www/html/xtendanceweb/vendor/composer/8fe377e7'
sh: 1: Cannot fork
The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)
Unzip with unzip command failed, falling back to ZipArchive class
I don't know why this is happening, any help would be helpful for me

Do composer clearcache first, then try to run the command again

Related

Composer found when running directly, but not when running artisan

I am helping work on a site that uses OctoberCMS. I was trying to update to the latest release, but when I run the Artisan command to update October, I get the following error:
$ php artisan october:update
Updating October CMS...
Executing: composer update
'composer' is not recognized as an internal or external command, operable program or batch file.
[ERROR] Update failed. Check output above
However, if I run composer update directly, it works as expected:
$ composer update
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
> System\Console\ComposerScript::postAutoloadDump
INFO Discovering packages.
laravel/tinker .............................................................................. DONE
nesbot/carbon ............................................................................... DONE
nunomaduro/termwind ......................................................................... DONE
october/rain ................................................................................ DONE
94 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> System\Console\ComposerScript::postUpdateCmd
No security vulnerability advisories found
It has been close to 10 years since I did much PHP development, so my Composer-fu is more than a little rusty. If there is more info needed to help diagnose what's going on, let me know!
Environment:
Windows 11 Pro
Git Bash (running in ConEmu)
PHP 8.1.3
Composer 2.4.4
Can you try running composer in commandline/powershell? (You will likely see the same error)
'composer' is not recognized as an internal or external command, operable program or batch file.
Is not a response Git Bash or a linux like terminal would produce.
I think artisan is trying to run composer in a windows shell and can't find it in your PATH, but for some reason you have it in your Git Bash path.

Laravel sail / composer require: chmod (directory attributes) error: Operation not permitted

I'm trying to run composer with Laravel Sail but getting errors:
$ sail composer require laravel/passport
Using version [32m^10.1[39m for [32mlaravel/passport[39m
[32m./composer.json has been updated[39m
[32mRunning composer update laravel/passport[39m
[32mLoading composer repositories with package information[39m
[32mUpdating dependencies[39m
[32mLock file operations: 13 installs, 0 updates, 0 removals[39m
- Locking [32mdefuse/php-encryption[39m ([33mv2.2.1[39m)
- Locking [32mfirebase/php-jwt[39m ([33mv5.2.1[39m)
- Locking [32mlaravel/passport[39m ([33mv10.1.0[39m)
- Locking [32mlcobucci/clock[39m ([33m2.0.0[39m)
- Locking [32mlcobucci/jwt[39m ([33m4.1.1[39m)
- Locking [32mleague/event[39m ([33m2.2.0[39m)
.
.
.
- Installing [32mlcobucci/jwt[39m ([33m4.1.1[39m): Extracting archive
- Installing [32mparagonie/random_compat[39m ([33mv9.99.100[39m): Extracting archive
- Installing [32mdefuse/php-encryption[39m ([33mv2.2.1[39m): Extracting archive
- Installing [32mleague/oauth2-server[39m ([33m8.2.4[39m): Extracting archive
- Installing [32mfirebase/php-jwt[39m ([33mv5.2.1[39m): Extracting archive
- Installing [32mlaravel/passport[39m ([33mv10.1.0[39m): Extracting archive
0/13 [>---------------------------] 0% [30;43mFailed to extract lcobucci/clock: (1) unzip -qq '/var/www/html/vendor/composer/tmp-252368372558a177ddb259c3ca81856b' -d '/var/www/html/vendor/composer/29d600e9'
chmod (directory attributes) error: Operation not permitted
fchmod (file attributes) error: Operation not permitted
warning: cannot set modif./access times for /var/www/html/vendor/composer/43c7b0b4/laravel-passport-c2b93a7/LICENSE.md
Operation not permitted
fchmod (file attributes) error: Operation not permitted
warning: cannot set modif./access times for /var/www/html/vendor/composer/43c7b0b4/laravel-passport-c2b93a7/README.md
Operation not permitted
.
.
.
warning: cannot set permissions for /var/www/html/vendor/composer/43c7b0b4/laravel-passport-c2b93a7/config/
Operation not permitted
warning: set times/attribs failed for /var/www/html/vendor/composer/43c7b0b4/laravel-passport-c2b93a7/config/
warning: cannot set modif./access times for /var/www/html/vendor/composer/43c7b0b4/laravel-passport-c2b93a7/
Operation not permitted
warning: cannot set permissions for /var/www/html/vendor/composer/43c7b0b4/laravel-passport-c2b93a7/
Operation not permitted
warning: set times/attribs failed for /var/www/html/vendor/composer/43c7b0b4/laravel-passport-c2b93a7/
[39;49m
The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)
Unzip with unzip command failed, falling back to ZipArchive class
[37;41mInstall of laravel/passport failed[39;49m
I've basically just followed the docs for installation, then proceeded to try and install a package. Can't find anything specific to Sail online with this error. Any ideas?
Full Disk Access to Terminal from Security & Privacy fixed my issue.
I ran into exactly the same problem while trying to install Laravel Breeze in a Docker container using the sail command.
Simply run this command in your application directory within your Docker container first:
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
laravelsail/php81-composer:latest \
composer install --ignore-platform-reqs
The command installs all the latest required composer dependencies and updates your composer file without any of the file restrictions you encountered. In my case, it automatically ran sail composer require laravel/breeze --dev command for me without me having to run it manually.
After that, I only needed to run
sail artisan breeze:install
sail npm install
sail npm run dev
in order.
You can see more details in the Laravel documentation here.
Worked to fix the same issue for me:
./vendor/bin/sail up -d
For me, it was caused by enabling VirtioFS in Docker Desktop 4.6.0 for Mac. I had to disable it and go back to previous driver. However, there're working on it, so probably it'll be fixed in the near future.
In WSL, I was able to solve the problem by enabling chmod.
Please refer to the following issue for instructions.
https://github.com/Microsoft/WSL/issues/81#issuecomment-796798258

Can't execute composer.phar in shared hosting

I've installed Composer on a shared-host (hostgator) following this guide:
https://laravel.io/forum/02-13-2014-how-to-install-laravel-on-a-hostgator-shared-server
It was installed using this command:
curl -sS https://getcomposer.org/installer | php
When I try to run composer I get the message "/home2/georger/composer.phar: no such file or directory" although the file does exist, I can open it. Other questions that deal with this suggest moving it to /usr/local/bin but that's not an option for me.
As outlined in the installation instructions, you will need to pass it to the php interpreter:
$ php composer.phar
Alternatively, you might want to reconsider whether you really want to execute composer in a production environment or rather execute it during the deployment and then deploy the artifacts. In other words, you probably want to run composer install on the machine from which you want to deploy to the production system, and then synchronize files from there to the production system, for example, using rsync.
For reference, see https://getcomposer.org/doc/00-intro.md.

command line composer command not defined

I am following the composer developer Tutorial: https://hyperledger.github.io/composer/tutorials/developer-guide.html
Everything worked till the point when I am running from the command line:
$ composer archive create -a dist/my-network.bna --sourceType dir --sourceName .
-bash: fds: command not found
The composer command was not found. When built by npm install the script can execute the composer command within the package.json
Next I installed php composer from: https://getcomposer.org - Which might be the wrong package?
$ composer network deploy
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "network" is not defined.
My 2 questions: is this the right package, if not how can I remove it safely?
Furthermore, how can I execute the composer command.
You need to npm install -g composer-cli -- please refer to the documentation.

Openshift and HtmlServiceProvider

I have pushed my local app to openshift and now get the following error message
PHP Fatal error: Class 'Illuminate\Html\HtmlServiceProvider' not found in /var/lib/openshift/5728b9782d5271802600015c/app-root/runtime/repo/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 150
How do I fix this on Openshift?
The solution locally would be to run composer update but how do I run that command on Openshift? I know there is rhc command line tool but is it possible to do a composer update with rhc?
You should check for the files first. You may have corrupted/missing files during upload. If you do not have vendor directory, you shoudl run composer update.
If files are there, run composer dumpauto on the server.
You can connect to you server with SSH and run these commands from terminal.
If you do not have access to SSH, you could try to run there commands using small PHP script with shell_exec('composer update'); clause in it, or just upload all vendor files manually.
I got ssh access and did the commands necessary to correct the problems

Resources