为什么Composer为Laravel创建项目执行失败? [英] Why does Composer create-project execution for Laravel fail?

查看:603
本文介绍了为什么Composer为Laravel创建项目执行失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除非我使用 sudo 我的composer命令无法创建一个Laravel项目。



code> sudo 它给我以下错误:

  [ErrorException] 
copy(/Users/H/.composer/cache/files/laravel/laravel/73094f2633f1b90f3ef
6de4a8a5b610532510e0e.zip):无法打开流:权限被拒绝
解决方案

如果你执行了:

  sudo composer< anything& 

您的一些作曲家主文件(〜/ .composer / )将由 root 写入,如果您不能再次删除或重写,除非您使用 sudo 成为root,因此您有两个选项:



1)将这些文件的用户更改回您自己的



  sudo chown $ USER:$ USER -R〜/ .composer 

或在mac上

  sudo chown -R $ USER:staff〜/ .composer 

2)删除整个文件夹(并丢失缓存)从头开始重新启动:

  sudo rm -rf〜/ .composer / cache 


b $ b

或甚至

  sudo rm -rf〜/ .composer 


It appears that unless I use sudo my composer command fails to create a Laravel project.

Without sudo it gives me the following error:

[ErrorException]                                                             
  copy(/Users/H/.composer/cache/files/laravel/laravel/73094f2633f1b90f3ef  
  6de4a8a5b610532510e0e.zip): failed to open stream: Permission denied  

What am I missing here?

解决方案

If you ever execute:

sudo composer <anything>

Some of your composer home files (~/.composer/) will be written by the root and if you can't delete or write over them again unless you use sudo to become root, so you have 2 options:

1) Change the user of those files back to your own:

sudo chown $USER:$USER -R ~/.composer

Or on a mac

sudo chown -R $USER:staff ~/.composer

2) Delete the whole folder (and lose your cache) to restart from scratch:

sudo rm -rf ~/.composer/cache

or even

sudo rm -rf ~/.composer

这篇关于为什么Composer为Laravel创建项目执行失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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