[英]Yii2 composer returns an error in installation
AM using ubuntu linux in my development 我在开发中使用ubuntu linux
I was installing yii2 advanced template via 我正在通过安装yii2高级模板
composer create-project nenad/yii2-advanced-template advanced
Which starts the installation upto the point when the vendor directories are being installed and it fails with the error 这将开始安装,直到安装了供应商目录时才失败,并显示错误
After some research i found out that i need to instal global asset plugin via 经过一番研究,我发现我需要通过以下方式安装全球资产插件
composer global require "fxp/composer-asset-plugin:~1.2.0"
But now am getting an error of 但是现在出现了一个错误
Changed current directory to /home/myusername/.composer
[ErrorException]
file_put_contents(./composer.json): failed to open stream: Permission denied
I understand its a permission issue and i have 我了解其权限问题,而且我有
sudo chomd 0777 -R /var/www/html/yii2/advanced
but this havent solved the file_put_content error 但这还没有解决file_put_content错误
I have tried 我努力了
sudo chmod 0777 -R /home/myusername/.composer
but this also fails 但这也失败了
What else do i need to do 我还需要做什么
Using 777
as permission mask is a bad idea. 使用
777
作为权限掩码不是一个好主意。 I'd recommend to use chown
command instead. 我建议改用
chown
命令。
sudo chown -R $USER:$USER /home/$USER/.composer
This will make composer directory owned by your user and you can use 755
for directories and 644
for files. 这将使composer目录归您的用户所有,您可以将
755
用于目录,将644
用于文件。
To make it clear, what problem composer exactly stumbled upon, try running require command with -vvv
option. 为了弄清楚到底是哪个问题作曲家偶然发现的,请尝试运行带有
-vvv
选项的require命令。 This allows you to run composer in full verbose mode and get debug information. 这使您可以在完整模式下运行composer并获取调试信息。
composer -vvv global require "fxp/composer-asset-plugin:~1.2.0"
Look into ~/composer
folder and doublecheck file permissions and owner with ls -al
查看
~/composer
文件夹,并使用ls -al
仔细检查文件权限和所有者
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.