0

0

这些composer错误你都遇到过吗?

藏色散人

藏色散人

发布时间:2021-11-09 16:44:01

|

2549人浏览过

|

来源于juejin

转载

本文由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
https://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 error
Retrying 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 failed
Failed to enable crypto
failed to open stream: operation failed
    Now trying to download from source

解决方案

xqcms简单实用的企业建站cms3.1 mysql版
xqcms简单实用的企业建站cms3.1 mysql版

这个cms是为使用的人设计的,并不是给程序员设计的,可以免费使用,免费版不提供技术支持,看时间情况可以帮你处理使用当中遇到的问题,呵呵,希望大家都能挣点小钱!3.1主要更新:1.优化了静态页面生成速度2.更改了系统后台框架3.更改了模板调用标签4.修复了模板部分调用错误5.优化了其他部分细节

下载
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 \usr\local\ssl\cert.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 https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors 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是什么插件
composer是什么插件

Composer是一个PHP的依赖管理工具,它可以帮助开发者在PHP项目中管理和安装依赖的库文件。Composer通过一个中央化的存储库来管理所有的依赖库文件,这个存储库包含了各种可用的依赖库的信息和版本信息。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

150

2023.12.25

scripterror怎么解决
scripterror怎么解决

scripterror的解决办法有检查语法、文件路径、检查网络连接、浏览器兼容性、使用try-catch语句、使用开发者工具进行调试、更新浏览器和JavaScript库或寻求专业帮助等。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

188

2023.10.18

500error怎么解决
500error怎么解决

500error的解决办法有检查服务器日志、检查代码、检查服务器配置、更新软件版本、重新启动服务、调试代码和寻求帮助等。本专题为大家提供相关的文章、下载、课程内容,供大家免费下载体验。

291

2023.10.25

SSL检测工具介绍
SSL检测工具介绍

SSL检测工具有SSL Labs、SSL Check、SSL Server Test、SSLMate、SSL/TLS Analyzer等。详细介绍:1、SSL Labs是一个由Qualys提供的在线SSL检测工具,可以评估服务器证书的部署情况、加密套件、协议支持等方面的安全性,它提供了一个详细的报告,包括证书的颁发者、有效期、安全性配置等;2、SSL Check等等。

332

2023.10.20

磁盘配额是什么
磁盘配额是什么

磁盘配额是计算机中指定磁盘的储存限制,就是管理员可以为用户所能使用的磁盘空间进行配额限制,每一用户只能使用最大配额范围内的磁盘空间。php中文网为大家提供各种磁盘配额相关的内容,教程,供大家免费下载安装。

1352

2023.06.21

如何安装LINUX
如何安装LINUX

本站专题提供如何安装LINUX的相关教程文章,还有相关的下载、课程,大家可以免费体验。

704

2023.06.29

linux find
linux find

find是linux命令,它将档案系统内符合 expression 的档案列出来。可以指要档案的名称、类别、时间、大小、权限等不同资讯的组合,只有完全相符的才会被列出来。find根据下列规则判断 path 和 expression,在命令列上第一个 - ( ) , ! 之前的部分为 path,之后的是 expression。还有指DOS 命令 find,Excel 函数 find等。本站专题提供linux find相关教程文章,还有相关

294

2023.06.30

linux修改文件名
linux修改文件名

本专题为大家提供linux修改文件名相关的文章,这些文章可以帮助用户快速轻松地完成文件名的修改工作,大家可以免费体验。

777

2023.07.05

c++空格相关教程合集
c++空格相关教程合集

本专题整合了c++空格相关教程,阅读专题下面的文章了解更多详细内容。

0

2026.01.23

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
第二十四期_PHP8编程
第二十四期_PHP8编程

共86课时 | 3.4万人学习

成为PHP架构师-自制PHP框架
成为PHP架构师-自制PHP框架

共28课时 | 2.4万人学习

第二十三期_PHP编程
第二十三期_PHP编程

共93课时 | 6.9万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号