【问题标题】:Laravel project cloned from GIT not working从 GIT 克隆的 Laravel 项目无法正常工作
【发布时间】:2018-10-18 21:58:54
【问题描述】:

每次我将 Laravel 项目(例如:https://github.com/flytomek/shopping-list)克隆到我的 XAMPP localhost 中时,都会收到这个奇怪的错误:

警告:需要(/Applications/XAMPP/xamppfiles/htdocs/shopping-list/vendor/autoload.php):无法打开流:/Applications/XAMPP/xamppfiles/htdocs/shopping-list 中没有这样的文件或目录/工匠在第 18 行

致命错误:require():需要打开失败 '/Applications/XAMPP/xamppfiles/htdocs/shopping-list/vendor/autoload.php' (include_path='.:') 在 /Applications/XAMPP/xamppfiles/htdocs/shopping-list/artisan 在第 18 行

我查看了许多类似的帖子,运行: composer install --no-scripts 我仍然得到同样的错误。

首先我认为这是因为文件权限,我正在运行 macOS,并且遇到了脚本无法访问文件的类似问题,但我运行了 chmod -R 777 shopping-list 并得到了同样的问题。

【问题讨论】:

  • 表示vendors 目录中的文件不存在。检查它是否正确。我认为您在使用 composer 安装依赖项时做错了。你为什么用--no-scripts
  • 试试composer updatecomposer dump-autoload

标签: git laravel terminal


【解决方案1】:

1- 安装作曲家

2- 将 .env.example 重命名为 .env 并使用您的数据库凭据对其进行更新

然后在你的项目终端中运行这3条命令

3-$ php artisan key:generate

4-$ composer update

5-$ php artisan serve

从这个 url 你可以正常运行它。

【讨论】:

    【解决方案2】:

    如前所述,大多数(如果不是全部)laravel 项目不包括 vendor/ 和 node_modules/ 目录。

    查看您列出的存储库中 .gitignore 的内容:

    /node_modules
    /public/hot
    /public/storage
    /storage/*.key
    /vendor
    /.idea
    /.vscode
    /.vagrant
    Homestead.json
    Homestead.yaml
    npm-debug.log
    yarn-error.log
    .env
    

    所以这三个步骤应该让你运行:

    1. 创建:.env
    2. 运行:作曲家安装
    3. 运行:npm install

    【讨论】:

      猜你喜欢
      • 2019-12-23
      • 2019-01-30
      • 1970-01-01
      • 2017-05-05
      • 2013-07-30
      • 2015-08-04
      • 1970-01-01
      • 2021-12-31
      • 1970-01-01
      相关资源
      最近更新 更多