运行composer而不使用sudo [英] Running composer without using sudo

查看:772
本文介绍了运行composer而不使用sudo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了从作曲家网站全球安装作曲家的指南: https:/ /getcomposer.org/doc/00-intro.md#globally



问题是我每次使用composer时都要使用sudo。这是一个痛苦,因为使用 sudo composer update 创建的每个供应商文件夹都位于 root 更改为 www-data



我尝试过的操作: >

我已经尝试使用 chmod + x / usr / local / bin / composer ,这还需要我运行composer sudo

更改 / usr / local /

的所有者 bin / composer www-data:www-data ,权限设置为775.仍然需要我先运行带有sudo的作曲家。 p>

我如何解决这个问题,所以我不必每次运行composer时使用 sudo strong>

解决方案

找出问题。



必须清除 /home/lamp/.composer 中的快取或变更此



2的拥有者)并更改 / usr / local / bin / composer的所有者



运行composer命令,而不使用 sudo


I've followed the guide on installing composer globally from the composer site: https://getcomposer.org/doc/00-intro.md#globally

The problem is I have to use sudo every time I use composer. This is a pain as every vendor folder that's created with sudo composer update is under the owner of root which I have to change to www-data.

Things I've tried:

I've tried using chmod +x /usr/local/bin/composer which still requires me to run composer with sudo as the file is owned by root.

Changing owner of /usr/local/bin/composer to www-data:www-data with privileges set to 775. Still requires me to run composer with sudo prepended first.

How can I resolve this so I do not have to use sudo every time I run composer?

解决方案

Figured out the problem.

1) I either had to clear out the cache in /home/lamp/.composer or change the owner of this

2) And change the owner of /usr/local/bin/composer

After doing these 2 changes I can now run composer commands without using sudo.

这篇关于运行composer而不使用sudo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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