无法在 ubuntu 上使用 composer 安装 laravel 4
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16951606/
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
Unable to install laravel 4 using composer on ubuntu
提问by Danny Cullen
ubuntu@ip-10-252-31-19:/$ sudo curl -sS https://getcomposer.org/installer | sudo php
ubuntu@ip-10-252-31-19:/$ sudo mv composer.phar /usr/local/bin/composer
ubuntu@ip-10-252-31-19:/$ cd /home/user
ubuntu@ip-10-252-31-19:/home/user$ sudo wget https://github.com/laravel/laravel/archive/master.zip
ubuntu@ip-10-252-31-19:/home/user$ unzip master.zip
ubuntu@ip-10-252-31-19:/home/user$ cd laravel-master
ubuntu@ip-10-252-31-19:/home/user/laravel-master$ sudo composer install
Loading composer repositories with package information
Installing dependencies (including require-dev)
ubuntu@ip-10-252-31-19:/home/user/laravel-master$ sudo composer update
PHP Warning: require(/home/user/laravel-master/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /home/user/laravel-master/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/home/user/laravel-master/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/user/laravel-master/bootstrap/autoload.php on line 17
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Warning: require(/home/user/laravel-master/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /home/user/laravel-master/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/home/user/laravel-master/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/user/laravel-master/bootstrap/autoload.php on line 17
ubuntu@ip-10-252-31-19:/home/user/laravel-master$ sudo composer dump-autoload -o
Generating autoload files
ubuntu@ip-10-252-31-19:/home/user/laravel-master$ sudo composer update
PHP Fatal error: Class 'Patchwork\Utf8\Bootup' not found in /home/user/laravel-master/bootstrap/autoload.php on line 46
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Fatal error: Class 'Patchwork\Utf8\Bootup' not found in
/home/user/laravel-master/bootstrap/autoload.php on line 46
I've spent quite a lot of time playing around and couldn't find any documentation on this problem, I will be honest and say I don't know enough about composer to solve it.
我花了很多时间玩,但找不到关于这个问题的任何文档,老实说,我对作曲家的了解不够,无法解决它。
EDIT
编辑
I tried the following which was suggested in the answers, without any luck.
我尝试了答案中建议的以下内容,但没有任何运气。
ubuntu@ip-10-252-31-19:/home/user$ sudo composer create-project laravel/laravel master
Installing laravel/laravel (v4.0.0)
- Installing laravel/laravel (v4.0.0)
Loading from cache
Created project in laravel
Loading composer repositories with package information
Installing dependencies (including require-dev)
ubuntu@ip-10-252-31-19:/home/user$ ls
master
ubuntu@ip-10-252-31-19:/home/user$ cd master
ubuntu@ip-10-252-31-19:/home/user/master$ ls
app artisan bootstrap composer.json CONTRIBUTING.md phpunit.xml public readme.md server.php
ubuntu@ip-10-252-31-19:/home/user/master$ sudo composer install --no-scripts
Loading composer repositories with package information
Installing dependencies (including require-dev)
ubuntu@ip-10-252-31-19:/home/user/master$ ls
app artisan bootstrap composer.json CONTRIBUTING.md phpunit.xml public readme.md server.php
ubuntu@ip-10-252-31-19:/home/user/master$ sudo composer dump-autoload -o
Generating autoload files
ubuntu@ip-10-252-31-19:/home/user/master$ ls
app artisan bootstrap composer.json CONTRIBUTING.md phpunit.xml public readme.md server.php vendor
ubuntu@ip-10-252-31-19:/home/user/master$ sudo tail /var/log/nginx/error.log
2013/06/06 15:50:56 [error] 20042#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'Patchwork\Utf8\Bootup' not found in /home/user/master/bootstrap/autoload.php on line 46"
while reading response header from upstream, client: w.x.y.z, server: dom.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "dom.com"
采纳答案by rusty009
This looks like your composer isn't working which is usually a characteristic of a non-compatible PHP version. What version is your PHP ? Laravel requires >= 5.3.7
这看起来像您的作曲家不起作用,这通常是不兼容的 PHP 版本的特征。你的 PHP 是什么版本?Laravel 需要 >= 5.3.7
Try updating PHP and re-running composer by issuing the following commands
尝试通过发出以下命令更新 PHP 并重新运行 Composer
-add PHP5 to your apt-get repository
- 将 PHP5 添加到您的 apt-get 存储库
sudo add-apt-repository ppa:ondrej/php5
-update your apt-get
- 更新你的 apt-get
sudo apt-get update
-reinstall PHP, making sure you overwrite your current version with the new one !
-重新安装 PHP,确保用新版本覆盖当前版本!
sudo apt-get install php5-fpm php5-cli php5-cgi
Restart nginx just to be sure then re run composer install in the laravel directory.
重新启动 nginx 以确保然后在 laravel 目录中重新运行 composer install。
回答by radmen
I had the same issue lately. Just run composer with --no-scripts
flag.
我最近有同样的问题。只需运行带有--no-scripts
标志的作曲家。
composer update --no-scripts
composer update --no-scripts
回答by Christopher Pecoraro
Here's a one liner script to install Laravel 4 on Ubuntu with PHP unit http://irventu.com/installing-laravel-4-with-phpunit-composer/
这是一个使用 PHP 单元在 Ubuntu 上安装 Laravel 4 的单行脚本http://irventu.com/installing-laravel-4-with-phpunit-composer/
回答by Matthew Fritz
Are you trying to run composer update
instead of first running composer install
?
你想跑composer update
而不是先跑composer install
吗?
I had this problem when I tried getting my existing project running on a different PC.
当我尝试在另一台 PC 上运行现有项目时遇到了这个问题。
Once I pulled my project git down I tried to do a composer update
instead of first running composer install
which gave me the same issue.
一旦我拉下我的项目 git,我尝试做一个composer update
而不是第一次运行composer install
,这给了我同样的问题。
Once I had run the composer install
command my project downloaded and installed the various required dependencies without any further issues.
一旦我运行了composer install
命令,我的项目就下载并安装了各种必需的依赖项,没有任何进一步的问题。
回答by Alexandre Danault
I had the same issue, this is what worked for me:
我有同样的问题,这对我有用:
- Backup your composer.json
- Edit comooser.json and remove the whole "scripts" block
- Save
- composer install
- Restore original composer.json
- composer update
- 备份你的 composer.json
- 编辑 comooser.json 并删除整个“脚本”块
- 节省
- 作曲家安装
- 恢复原来的 composer.json
- 作曲家更新
Seems like we don't have all the dependencies needed to run artisan on a bare install, but once everything has been fetched by composer, it runs fine.
似乎我们没有在裸安装上运行 artisan 所需的所有依赖项,但是一旦 composer 获取了所有内容,它就可以正常运行。
回答by Thomas Clarkson
You could try composer update instead of composer install. Per the docs http://laravel.com/docs/installationthere is a easier way to install laravel by running the command sudo composer create-project laravel/laravel nameofproject
您可以尝试 composer update 而不是 composer install。根据文档http://laravel.com/docs/installation,通过运行命令 sudo composer create-project laravel/laravel nameofproject 可以更轻松地安装 laravel
回答by Seth Kniceley
After running phpinfo, I noticed "--disable-mbregex" was part of the PHP configuration, meaning PHP was not compiled with the mbregex extension. My error logs were showing "Call to undefined function mb_regex_encoding".
运行 phpinfo 后,我注意到“--disable-mbregex”是 PHP 配置的一部分,这意味着 PHP 没有使用 mbregex 扩展名编译。我的错误日志显示“调用未定义的函数 mb_regex_encoding”。
Once PHP was recompiled with mb_regex_encoding, the issue went away.
使用 mb_regex_encoding 重新编译 PHP 后,问题就消失了。