本文由composer教程栏目给大家介绍关于composer遇到的一些错误,希望对需要的朋友有所帮助!
composer遇到的错误汇集
1#权限错误
file_put_contents(/home/vagrant/.composer/cache/repo/https---packagist.laravel-china.org/packages.json): failed to open stream: Permission deniedhttps://packagist.laravel-china.org could not be fully loaded, package information was loaded from the local cache and may be out of date
解决方法:sudo chown -R $USER ~/.composer/
2# zlib_decode():data error
Failed to decode response: zlib_decode(): data errorRetrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
解决方法 更换composer的repo.packagist
3# SSL routines:ssl3_get_server_certificate:certificate verify failed
错误描述
- Installing phpunit/phpunit (6.5.8): Downloading (failed)Downloading (failed)Downloading (failed) Failed to download phpunit/phpunit from dist: The "https://files.phpcomposer.com/files/sebastianbergmann/phpunit/4f21a3c6b97c42952fd5c2837bb354ec0199b97b.zip" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failedFailed to enable cryptofailed to open stream: operation failed Now trying to download from source
解决方案
挖错网
一款支持文本、图片、视频纠错和AIGC检测的内容审核校对平台。
28 查看详情
In my case, it was the CA Cert file that was the culpritOpen terminal and run php -r "var_dump(openssl_get_cert_locations());"Note the location of default_cert_file. It might say usrlocalsslcert.pemVerify that that file exists. If not, download the cacert.pem file from https://curl.haxx.se/ca/cacert.pem and place it in somewhere preferably in /usr/local/sslYou now have a file is usr/local/ssl/cacert.pemOpen your php.ini and add the location of the file openssl.cafile=cacert.pemRun composer config --global cafile "/usr/local/ssl/cacert.pem"If it's of any use to others, I use valet+ 1.0.26, composer 1.8.4 OSX Movajes 10.14.3, php7.3 and simply specifying the cert composer looks for with:composer config --global cafile "/usr/local/etc/openssl/cert.pem"
composer config --global cafile "C:/AMP_ENV/php-7.1.15/ca/cacert.pem"composer config --global --list
4# proc_open(): fork failed – Cannot allocate memory
错误描述
Installation failed, reverting ./composer.json to its original content.The following exception is caused by a lack of memory or swap, or not having swap configuredCheck https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for detailsPHP Warning: proc_open(): fork failed - Cannot allocate memory in phar:///usr/local/bin/composer/vendor/symfony/console/Application.php on line 952Warning: proc_open(): fork failed - Cannot allocate memory in phar:///usr/local/bin/composer/vendor/symfony/console/Application.php on line 952 [ErrorException] proc_open(): fork failed - Cannot allocate memory
解决方式
sudo dd if=/dev/zero of=/var/swap.1 bs=1M count=1024sudo mkswap /var/swap.1sudo swapon /var/swap.1
5# 执行 composer 抛出 Killed
错误描述
root@test2:/work/usrc$ composer require qcloud/cos-sdk-v5./composer.json has been updatedThe "extra.asset-installer-paths" option is deprecated, use the "config.fxp-asset.installer-paths" optionLoading composer repositories with package informationUpdating dependencies (including require-dev)Killed
解决方式
出现此原因大多因为缓存不足造成,在linux环境可增加缓存解决。
free -msudo mkdir -p /var/_swap_cd /var/_swap_sudo dd if=/dev/zero of=swapfile bs=1M count=2000sudo mkswap swapfilesudo swapon swapfilesudo echo "/var/_swap_/swapfile none swap sw 0 0" >> /etc/fstabfree -m
以上就是这些composer错误你都遇到过吗?的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/555488.html
微信扫一扫
支付宝扫一扫