作曲者:file_put_contents(./composer.json):无法打开流:权限被拒绝 [英] Composer: file_put_contents(./composer.json): failed to open stream: Permission denied

查看:786
本文介绍了作曲者: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,但是作曲家然后总是说:

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

有什么办法可以解决这个问题吗?

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/

这篇关于作曲者:file_put_contents(./composer.json):无法打开流:权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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