作曲家:file_put_contents(./composer.json):无法打开流:权限被拒绝

Composer: file_put_contents(./composer.json): failed to open stream: Permission denied(作曲家:file_put_contents(./composer.json):无法打开流:权限被拒绝)
本文介绍了作曲家: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/

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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)