【问题标题】:Laravel 4.2 Composer install error: Could not scan for classes inside "app/models"Laravel 4.2 Composer 安装错误:无法扫描“app/models”中的类
【发布时间】:2015-06-08 01:59:11
【问题描述】:

在我的 Laravel 4.2 项目中,我已将我的用户模型移动到我的应用程序目录中的一个新目录中。

-app/

--Acme/

---Users/

----User.php

然后我删除了 app/models 目录

我将此添加到我的 composer.json 文件中

"autoload": {
    "classmap": [
        "app/commands",
        "app/controllers",
        "app/models",
        "app/database/migrations",
        "app/database/seeds",
        "app/tests/TestCase.php",
        "app/Acme/adminHelpers.php"
    ],
    "files": [
        "app/Acme/helpers.php",
        "app/Acme/adminHelpers.php"
    ],
    "psr-4": {
        "Acme\\": "app/Acme"
    }
},

我还编辑了我的 app/auth.php 文件

/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
| When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
*/

'model' => 'app\Acme\Users\User',

然后我跑了composer dump-autoload

我现在正在尝试使用 Laravel Forge 安装我的 Github 存储库,但我不断收到此错误:

...
Writing lock file
Generating autoload files



   [RuntimeException]                                                                              
  Could not scan for classes inside "app/models" which does not appear to be a file nor a folder 

有谁知道为什么会发生这种情况以及如何解决?

【问题讨论】:

    标签: laravel-4 composer-php


    【解决方案1】:

    我从 composer.json 文件中的 classmap 中删除了 "app/models",,现在它可以工作了。

    【讨论】:

      猜你喜欢
      • 2014-12-26
      • 2021-02-19
      • 2016-04-09
      • 2014-08-12
      • 2016-09-27
      • 2014-01-02
      • 2014-12-07
      • 2019-10-21
      • 2017-10-26
      相关资源
      最近更新 更多