无法在ubuntu上使用composer安装laravel 4

时间:2013-06-05 23:41:22

标签: laravel laravel-4 composer-php

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

我花了很多时间玩这个问题并找不到任何关于这个问题的文档,我会诚实地说我对作曲家的解释不够了。

修改

我尝试了以下答案中提出的建议,没有任何运气。

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"

7 个答案:

答案 0 :(得分:8)

我最近遇到了同样的问题。只需使用--no-scripts标志运行作曲家。

composer update --no-scripts

答案 1 :(得分:4)

这看起来像你的作曲家不工作,这通常是不兼容的PHP版本的特征。你的PHP是什么版本的? Laravel要求> = 5.3.7

尝试通过发出以下命令来更新PHP并重新运行composer

- 将PHP5添加到apt-get存储库

sudo add-apt-repository ppa:ondrej/php5

更新你的apt-get

sudo apt-get update

-reinstall PHP,确保用新的版本覆盖当前版本!

sudo apt-get install php5-fpm php5-cli php5-cgi

重启nginx只是为了确保在laravel目录中重新运行composer install。

答案 2 :(得分:2)

这是一个单行程序脚本,用于在Ubuntu上使用PHP单元http://irventu.com/installing-laravel-4-with-phpunit-composer/安装Laravel 4

答案 3 :(得分:1)

我有同样的问题,这对我有用:

  • 备份你的composer.json
  • 编辑comooser.json并删除整个“脚本”块
  • 保存
  • composer install
  • 恢复原始composer.json
  • 作曲家更新

似乎我们没有在裸机安装上运行artisan所需的所有依赖项,但是一旦所有内容都被作曲家提取,它运行正常。

答案 4 :(得分:1)

您是否尝试运行composer update而不是首先运行composer install

当我尝试让现有项目在另一台PC上运行时,我遇到了这个问题。

我拉下项目git后,我尝试composer update而不是先运行composer install,这给了我同样的问题。

运行composer install命令后,我的项目下载并安装了各种必需的依赖项,而没有任何进一步的问题。

答案 5 :(得分:0)

您可以尝试使用composer update而不是composer install。根据文档http://laravel.com/docs/installation,通过运行命令sudo composer create-project laravel / laravel nameofproject,可以更轻松地安装laravel

答案 6 :(得分:0)

运行phpinfo之后,我注意到“--disable-mbregex”是PHP配置的一部分,这意味着PHP没有使用mbregex扩展编译。我的错误日志显示“调用未定义的函数mb_regex_encoding”。

使用mb_regex_encoding重新编译PHP后,问题就消失了。