问题描述
[webadm@iZwz9g546trqlkooc4y8b2Z bsm-web]$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 2 installs, 0 updates, 0 removals
- Installing lcobucci/jwt (3.2.2): Downloading (failed) Failed to download lcobucci/jwt from dist: The "https://files.phpcomposer.com/files/lcobucci/jwt/0b5930be73582369e10c4d4bb7a12bac927a203c.zip" file could not be downloaded (HTTP/1.1 405 Not Allowed)
Now trying to download from source
- Installing lcobucci/jwt (3.2.2): Cloning 0b5930be73
[RuntimeException]
Failed to clone https://github.com/lcobucci/jwt.git via https, ssh protocols, aborting.
- https://github.com/lcobucci/jwt.git
error: while accessing https://github.com/lcobucci/jwt.git/info/refs
fatal: HTTP request failed
- git@github.com:lcobucci/jwt.git
Warning: Permanently added the RSA host key for IP address '13.229.188.59' to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
不知为何,安装不了jwt的依赖,改成国内的镜像源也没用,所以直接安装jwt
composer require lcobucci/jwt
然后又报了下面的错误
Using version ^3.2 for lcobucci/jwt
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
- Installing lcobucci/jwt (3.2.2): Loading from cache
proc_open(): fork failed - Cannot allocate memory
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
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
Warning: proc_open(): fork failed - Cannot allocate memory in phar:///usr/local/bin/composer/vendor/symfony/console/Application.php on line 959
[ErrorException]
proc_open(): fork failed - Cannot allocate memory
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>]...
根据问题描述可能是内存原因,maybe是没有给composer配置内存?
运行下面这几条命令后问题解决
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1
参考网址
https://blog.csdn.net/darry_zhao/article/details/52791568