Laravel 4.2 Composer安装错误:“无法扫描类”

时间:2014-10-30 07:33:58

标签: php laravel laravel-4 composer-php

我想通过Composer在我的新Laravel 4.2安装上安装一些软件包。但是,我有一个例外。

这是我的作曲家文件:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "license": "MIT",   
    "require": {
        "laravel/framework": "4.2.*",
        "zizaco/confide": "~4.0@dev",
        "zizaco/entrust": "1.2.*@dev",
        "barryvdh/laravel-ide-helper": "1.*",
        "fzaninotto/faker": "1.3.*@dev",
        "bllim/datatables": "~1.3",
        "barryvdh/laravel-debugbar": "~1.7"
    },
    "require-dev": {
        "way/generators": "~2.6",
        "barryvdh/laravel-ide-helper": "~1.11"
    },
    "autoload": {
        "classmap": [
            "app/commands",
            "app/controllers",
            "app/models",
            "app/database/migrations",
            "app/database/seeds",
            "app/tests/TestCase.php",
            "app/controllers/admin",
            "app/controllers/user"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd":[
            "php artisan ide-helper:generate"
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "stable"
}

运行composer install时,我得到:

$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.jso
n. You may be getting outdated dependencies. Run update to update them.
Nothing to install or update
Generating autoload files



  [RuntimeException]
  Could not scan for classes inside "app/controllers/admin" which does not ap
  pear to be a file nor a folder



install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-p
lugins] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--ver
bose] [-o|--optimize-autoloader] [packages1] ... [packagesN]

这基本上是一个新的Laravel装置。为什么我会收到错误:

Could not scan for classes inside "app/controllers/admin" which does not appear to be a file nor a folder

更新

使用composer update

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing mockery/mockery (0.9.2)
  - Removing phpunit/phpunit (4.3.4)
  - Removing phpunit/php-code-coverage (2.0.11)
  - Removing phpunit/php-token-stream (1.3.0)
  - Removing phpunit/php-file-iterator (1.3.4)
  - Removing phpunit/php-timer (1.0.5)
  - Removing phpunit/phpunit-mock-objects (2.3.0)
  - Removing phpunit/php-text-template (1.2.0)
  - Removing doctrine/instantiator (1.0.4)
  - Removing symfony/yaml (v2.5.6)
  - Removing sebastian/comparator (1.0.1)
  - Removing sebastian/diff (1.2.0)
  - Removing sebastian/environment (1.2.0)
  - Removing sebastian/exporter (1.0.2)
  - Removing sebastian/version (1.0.3)
  - Removing summerstreet/woodling (v0.1.6)
Writing lock file
Generating autoload files



  [RuntimeException]
  Could not scan for classes inside "app/controllers/admin" which does not ap
  pear to be a file nor a folder



update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock]
 [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with-
dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [
packagesN]

2 个答案:

答案 0 :(得分:1)

对于 2021 年的 laravel 8,如果不存在则在控制器中添加文件夹 admin 并且 转到 composer.json 并将 classmap 更改为


UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-3-7dd3504c366f> in <module>
----> 1 import pandas as pd

~\anaconda3\lib\site-packages\pandas\__init__.py in <module>
      9 for dependency in hard_dependencies:
     10     try:
---> 11         __import__(dependency)
     12     except ImportError as e:
     13         missing_dependencies.append(f"{dependency}: {e}")

~\anaconda3\lib\site-packages\numpy\__init__.py in <module>
    149     from . import fft
    150     from . import polynomial
--> 151     from . import random
    152     from . import ctypeslib
    153     from . import ma

~\anaconda3\lib\site-packages\numpy\random\__init__.py in <module>
    177 
    178 # add these for module-freeze analysis (like PyInstaller)
--> 179 from . import _pickle
    180 from . import _common
    181 from . import _bounded_integers

~\anaconda3\lib\site-packages\numpy\random\_pickle.py in <module>
----> 1 from .mtrand import RandomState
      2 from ._philox import Philox
      3 from ._pcg64 import PCG64
      4 from ._sfc64 import SFC64


**mtrand.pyx in init numpy.random.mtrand()**
      

答案 1 :(得分:0)

尝试使用composer update。这就是它在错误中所说的内容。

...You may be getting outdated dependencies. Run update to update them...

<强>更新

Composer正在尝试找到laravel中没有标准文件夹的文件夹app/controllers/admin。你确定这个文件夹存在吗?如果没有,您可以尝试从composer.json中删除这些和其他自定义文件夹,并手动添加它们。您也可以创建目录并保持composer.json不受影响。