安装Laravel时出现错误:"./composer.json不可写." [英] When installing Laravel i got an error: "./composer.json is not writable."

查看:264
本文介绍了安装Laravel时出现错误:"./composer.json不可写."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我运行的命令

composer global require "laravel/installer"

这是之后的文字和错误:

and this is the text and error i got after that:

Changed current directory to /home/dimitar/.composer
./composer.json is not writable.

我正在运行Ubuntu 16.04 LTS和PHP 7以及Composer 1.3.0版,并从我的主文件夹中运行此命令.

I'm running Ubuntu 16.04 LTS and PHP 7 and Composer version 1.3.0 and running this command from my home folder.

推荐答案

检查composer.json的所有者.

Check the owner of composer.json.

ls -lh ~/.composer/composer.json

如果它是'root',请运行:

If it's 'root', run:

sudo chown -R yourusername:yourusername ~/.composer/composer.json

在.composer文件夹中,检查'cache'文件夹所有者. 如果它是"root",请重新运行以上命令,但将composer.json切换到缓存. 否则,您可能会收到无法创建缓存目录"警告.

While in the .composer folder, check the 'cache' folder owner. If it's 'root', re-run above command but switch composer.json to the cache. Otherwise, you may end up with a 'Cannot create cache directory' warning.

这篇关于安装Laravel时出现错误:"./composer.json不可写."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆