WWW.lllT.neT文中由composer实例教程频道给各位讲解有关composer碰到的一些不正确,期待对必须的小伙伴有些协助!

composer碰到的不正确聚集

1#管理权限不正确

file_put_contents(/home/vagrant/.composer/cache/repo/https---packagist.laravel-china.org/packages.json): failed to open stream: Permission denied
http://www.lllt.net/img/20211203/eejj2a0rnsx 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 error
Retrying with degraded mode, check http://www.lllt.net/img/20211203/3qqo0ufyjn5.md 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 failed
Failed to enable crypto
failed to open stream: operation failed
    Now trying to download from source

解决方法

In my case, it was the CA Cert file that was the culprit
Open terminal and run php -r "var_dump(openssl_get_cert_locations());"
Note the location of default_cert_file. It might say usrlocalsslcert.pem
Verify 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/ssl
You now have a file is usr/local/ssl/cacert.pem
Open your php.ini and add the location of the file openssl.cafile=cacert.pem
Run 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 configured
Check http://www.lllt.net/img/20211203/h0anq1ycjb4.md for details
PHP Warning:  proc_open(): fork failed - Cannot allocate memory in phar:///usr/local/bin/composer/vendor/symfony/console/Application.php on line 952
Warning: 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=1024
sudo mkswap /var/swap.1
sudo swapon /var/swap.1

5# 实行 composer 抛出去 Killed

不正确叙述

root@test2:/work/usrc$ composer require qcloud/cos-sdk-v5
./composer.json has been updated
The "extra.asset-installer-paths" option is deprecated, use the "config.fxp-asset.installer-paths" option
Loading composer repositories with package information
Updating dependencies (including require-dev)
Killed

处理方法

发生此缘故大多数由于缓存文件不够导致,在linux自然环境可提升缓存文件处理。

free -m
sudo mkdir -p /var/_swap_
cd /var/_swap_
sudo dd if=/dev/zero of=swapfile bs=1M count=2000
sudo mkswap swapfile
sudo swapon swapfile
sudo echo "/var/_swap_/swapfile none swap sw 0 0" >> /etc/fstab
free -m

以上便是这种composer不正确你都遇到过吗?的详尽具体内容,大量请关心自学java网其他相关文章!

WWW.lllT.neT

声明:有的资源来自网络转载,版权归原作者所有,如有侵犯到您的权益请联系邮箱:our333@126.com我们将配合处理!

原文地址:这种composer不正确你都遇到过吗?发布于2021-12-05 16:44:01