请教下 Composer 的问题
新建的laravel项目 运行
composer install
然后运行
composer install -vvv
Reading ./composer.json
Loading config file /root/.config/composer/config.json
Loading config file /root/.config/composer/auth.json
Loading config file ./composer.json
Checked CA file /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem: valid
Executing command (/usr/share/nginx/html/aggregate): git branch --no-color --no-abbrev -v
Executing command (/usr/share/nginx/html/aggregate): git describe --exact-match --tags
Executing command (/usr/share/nginx/html/aggregate): git log --pretty="%H" -n1 HEAD
Executing command (/usr/share/nginx/html/aggregate): hg branch
Executing command (/usr/share/nginx/html/aggregate): fossil branch list
Executing command (/usr/share/nginx/html/aggregate): fossil tag list
Executing command (/usr/share/nginx/html/aggregate): svn info --xml
Failed to initialize global composer: Composer could not find the config file: /root/.config/composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Running 1.10.6 (2020-05-06 10:28:10) with PHP 7.2.11 on Linux / 4.18.0-147.5.1.el8_1.x86_64
Loading composer repositories with package information
Downloading https://mirrors.aliyun.com/composer/packages.json
Writing /root/.cache/composer/repo/https---mirrors.aliyun.com-composer/packages.json into cache
Updating dependencies (including require-dev)
......
Reading /root/.cache/composer/repo/https---mirrors.aliyun.com-composer/provider-scrivo$highlight.php.json from cache
Reading /root/.cache/composer/repo/https---mirrors.aliyun.com-composer/provider-illuminate$pipeline.json from cache
已杀死
请问下要怎样解决
服务器是新买的1G内存
网上查询过说是内存不足的问题 也尝试过不行 请问下还需要怎样排查?
已经杀死这个是程序输出的吗?感觉可以开着 top, 然后再另外一个 shell 窗口执行你上面的 composer 命令看内存的使用情况,如果是内存不足就换个更大内存的机器吧,我记得几年前 1 GB 内存的机器 wordpress 都搭建不起来。
@晓鹤
竟敢拿我宝儿姐做头像
这里的报错提示,貌似是没有 composer.json 或者 composer.lock 文件。你试试 composer create-project –prefer-dist laravel/laravel blog 这样看可以不?
测试是不是内存问题的笨办法:如果机器可以临时增加内存就加一下,如果不能就再买一台内存大点的测试下同样的代码(按时付费的那种),或者直接在本地跑同样的代码看下。
我记得之前我加过虚拟内存,你可以看下 discuss.flarum.org.cn/d/1317
Troubleshooting
Before asking anyone, run
composer diagnose
to check for common problems. If it all checks out, proceed to the next steps.故障排除第一步,输入
composer diagnose
。请检查: Composer could not find the config file: /root/.config/composer/composer.json
我记得是composer install命令不能在root用户权限下面运行,你可以试一下切换到其他用户下面运行,linux命令:sudo su。切换之前去新建一个用户,注意需要有修改权限。1G内存可以运行的。
@qf-Z
@杰大哥 @晓鹤 增加虚拟内存了 还是不可以 :sweat_smile:
@W_957 这个问题翻译过来是没找到全局的
composer.json
? 看起来跟内存没什么关系,确认/root/.config/composer/composer.json
文件存在且权限设置正确,实在不行建议重新安装。(真没遇过这种报错..)@晓鹤 重新试了下还是不行 :joy: 我重新装下composer 试试
我的服务器也是1G内存,也遇到了,原因就是内存不足,网上有解决办法,按照操作就行。