请教下 Composer 的问题

新建的laravel项目 运行

 composer install

请教下  composer 的问题

然后运行

 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内存
网上查询过说是内存不足的问题 也尝试过不行 请问下还需要怎样排查?

《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 12

已经杀死这个是程序输出的吗?感觉可以开着 top, 然后再另外一个 shell 窗口执行你上面的 composer 命令看内存的使用情况,如果是内存不足就换个更大内存的机器吧,我记得几年前 1 GB 内存的机器 wordpress 都搭建不起来。

3年前 评论

@晓鹤

file 这是峰值 会是内存的原因吗?

3年前 评论

竟敢拿我宝儿姐做头像

3年前 评论

Composer could not find the config file: /root/.config/composer/composer.json

这里的报错提示,貌似是没有 composer.json 或者 composer.lock 文件。你试试 composer create-project –prefer-dist laravel/laravel blog 这样看可以不?

file 另外这里能看到大概剩下 64.7 MB 可用内存了,机器有监控应该会报警的吧。如果是阿里云,有个监控面板,到那里看看内存、CPU 的使用占比情况。

测试是不是内存问题的笨办法:如果机器可以临时增加内存就加一下,如果不能就再买一台内存大点的测试下同样的代码(按时付费的那种),或者直接在本地跑同样的代码看下。

3年前 评论

我记得之前我加过虚拟内存,你可以看下 discuss.flarum.org.cn/d/1317

3年前 评论

Troubleshooting
Before asking anyone, run composer diagnose to check for common problems. If it all checks out, proceed to the next steps.
故障排除第一步,输入composer diagnose

3年前 评论
No_Panic

请检查: Composer could not find the config file: /root/.config/composer/composer.json

3年前 评论

我记得是composer install命令不能在root用户权限下面运行,你可以试一下切换到其他用户下面运行,linux命令:sudo su。切换之前去新建一个用户,注意需要有修改权限。1G内存可以运行的。

3年前 评论

@qf-Z file@杰大哥 @晓鹤 增加虚拟内存了 还是不可以 :sweat_smile:

file

3年前 评论
晓鹤 3年前
杰大哥 3年前

@W_957 这个问题翻译过来是没找到全局的 composer.json ? 看起来跟内存没什么关系,确认 /root/.config/composer/composer.json 文件存在且权限设置正确,实在不行建议重新安装。(真没遇过这种报错..)

3年前 评论

@晓鹤 重新试了下还是不行 :joy: 我重新装下composer 试试 file

3年前 评论
晓鹤 3年前
W_957 (作者) (楼主) 3年前
W_957 (作者) (楼主) 3年前

我的服务器也是1G内存,也遇到了,原因就是内存不足,网上有解决办法,按照操作就行。

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!