【问题标题】:Unable to install laravel 4 using composer on ubuntu无法在 ubuntu 上使用 composer 安装 laravel 4
【发布时间】:2013-06-01 20:13:18
【问题描述】:
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"

【问题讨论】:

  • 奇怪的是composer install之后你没有vendor目录。不知道为什么,但是作曲家没有下载任何包。而且,您正在使用带有sudo 的作曲家。也许尝试以普通用户的身份运行它?
  • 详细教程:How to install Laravel 4 on Ubuntu 12.04 LTS with Composer 包括 Apache & mod_rewrite 设置和 PHP 安装。

标签: laravel laravel-4 composer-php


【解决方案1】:

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

composer update --no-scripts

【讨论】:

  • 即使使用 --no-scripts 标志,我仍然收到 Class 'Patchwork\Utf8\Bootup' 错误
  • 我收到了错误:[RuntimeException] Error Output: PHP Fatal error: Class 'Bkwld\Croppa\CroppaServiceProvider' not found in...--no-scripts 已修复
  • 在 Laravel 错误 Class 'Bkwld\Croppa\ServiceProvider' not found987654325@ 之后,这在 Windows 7 上对我有用
【解决方案2】:

您的作曲家似乎无法正常工作,这通常是 PHP 版本不兼容的一个特征。你的 PHP 是什么版本? Laravel 需要 >= 5.3.7

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

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

sudo add-apt-repository ppa:ondrej/php5

-更新你的 apt-get

sudo apt-get update

-重新安装 PHP,确保用新版本覆盖当前版本!

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

重启 nginx 以确保然后在 laravel 目录中重新运行 composer install。

【讨论】:

    【解决方案3】:

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

    【讨论】:

    • 链接已失效。如果可用,请考虑用网络存档替换。
    【解决方案4】:

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

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

    似乎我们没有在裸安装上运行 artisan 所需的所有依赖项,但是一旦 composer 获取了所有内容,它就可以正常运行。

    【讨论】:

    • radmen 的回答比我的要好得多,也不那么“hackish”,--no-scripts 绝对可以解决问题。
    【解决方案5】:

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

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

    一旦我将项目 git 拉下来,我就尝试执行 composer update 而不是首先运行 composer install,这给了我同样的问题。

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

    【讨论】:

      【解决方案6】:

      您可以尝试 composer update 而不是 composer install。根据文档http://laravel.com/docs/installation,有一种更简单的方法来安装 laravel,方法是运行命令 sudo composer create-project laravel/laravel nameofproject

      【讨论】:

      • 官方的安装指南真的很烂,不能开箱即用。我知道,这听起来很奇怪,但确实如此。
      【解决方案7】:

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

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

      【讨论】:

        猜你喜欢
        • 2015-05-16
        • 2020-08-28
        • 2017-10-26
        • 2015-10-12
        • 2018-03-16
        • 2014-01-12
        • 2013-11-13
        • 2019-08-27
        • 2013-06-27
        相关资源
        最近更新 更多