作曲家:file_put_contents(./composer.json):无法打开流:权限被拒绝
我正在尝试将 Prestissimo 安装到 Ubuntu 16.04 服务器,但这会导致错误:
I'm trying to install Prestissimo to an Ubuntu 16.04 server, but that leads to an error:
$ composer global require "hirak/prestissimo:^0.3"
Changed current directory to /home/kramer65/.composer
[ErrorException]
file_put_contents(./composer.json): failed to open stream: Permission denied
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packages>]...
我以用户 kramer65
的身份登录,所以我不知道为什么它不能写入我的主文件夹.我对 permission denied
的正常反应是使用 sudo
,但 composer 总是说:
I'm logged in as user kramer65
, so I wouldn't know why it can't write to my home folder. My normal reaction to a permission denied
is to use sudo
, but composer then always says:
不要以 root/超级用户身份运行 Composer!详见https://getcomposer.org/root
Do not run Composer as root/super user! See https://getcomposer.org/root for details
知道如何解决这个问题吗?
Any idea how I can solve this?
推荐答案
我在安装 laravel/lumen 时遇到了这个问题.
I had this problem to install laravel/lumen.
可以通过以下命令解决:
It can be resolved with the following command:
$ sudo chown -R $USER ~/.composer/
相关文章