创建新项目时出现 Laravel 错误:在没有缓存的情况下继续
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35122625/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel error when creating new project: proceed without cache
提问by Mr Gibbous
I'm just starting with laravel. I'm following this laravel guide. My environment is an aws server running php 5.6, I have already installed composer. https://laravel.com/docs/5.2/quickstart#deleting-tasks
我刚开始使用laravel。我正在关注这个 Laravel 指南。我的环境是一个运行 php 5.6 的 aws 服务器,我已经安装了 composer。 https://laravel.com/docs/5.2/quickstart#deleting-tasks
When I type:
当我输入:
composer create-project laravel/laravel quickstart --prefer-dist
I get the following error:
我收到以下错误:
Cannot create cache directory /home/ubuntu/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
How can I fix this? Is this a major problem? If I proceed would I run into trouble after?
我怎样才能解决这个问题?这是一个大问题吗?如果我继续,我会遇到麻烦吗?
Also, is it bad practice to use sudo?
另外,使用 sudo 是不好的做法吗?
回答by Jim M
When you installed composer pretty sure you used $ sudo command because of that the ~/.composer
folder was created by the root.
当您安装 Composer 时,很确定您使用了 $ sudo 命令,因为该~/.composer
文件夹是由根创建的。
Run this to fix the issue:
运行此命令以解决问题:
$ sudo chown -R $USER $HOME/.composer
回答by Dale Nguyen
You can try this method which I used for my project on a LAMP server
您可以尝试我在 LAMP 服务器上用于我的项目的这种方法
sudo composer create-project laravel/laravel quickstart --prefer-dist
After that, you change the permission back to www-data user & group
之后,您将权限更改回 www-data 用户和组
sudo chown www-data:www-data quickstart\ -R
sudo usermod -a -G www-data ubuntu_user_name