【问题标题】:Symfony bundle error NotFoundException: Attempted to load class "FullCalendarBundle" from namespace "Toiba\FullCalendarBundle"Symfony 包错误 NotFoundException:尝试从命名空间“Toiba\FullCalendarBundle”加载类“FullCalendarBundle”
【发布时间】:2020-01-30 20:03:04
【问题描述】:

我在 php 7+ 和 symfony 3.4 中编写了一个 webapp,在开发模式下一切正常。

然后我尝试了这个命令:

composer install --no-dev

这个错误发生了:

[RuntimeException] 执行时出错 ""cache:clear --no-warmup"" 命令:

致命错误:未捕获 Symfony\Component\Debug\Exception\ClassNotFoundException:试图 从命名空间加载类“FullCalendarBundle” “Toiba\FullCalendarBundle”。您是否忘记了“使用”声明 另一个命名空间?在 F:\wamp64\www\justdrive\app\AppKernel.php:15

我已经尝试过修改这个:

"psr-4": {
    "AppBundle\\": "src/AppBundle"
},

到这里:

"psr-4": {
    "": "src/"
},

然后执行这个命令:

作曲家转储自动加载

但是在我提到的第一个命令之后我仍然得到同样的错误。

这是我的作曲家 .lock 中的捆绑包

{
            "name": "toiba/fullcalendar-bundle",
            "version": "v6.2.4",
            "source": {
                "type": "git",
                "url": "https://github.com/toiba/FullCalendarBundle.git",
                "reference": "d8b22cc3a159819fa2a4bbd1c7aad026c6bbad74"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/toiba/FullCalendarBundle/zipball/d8b22cc3a159819fa2a4bbd1c7aad026c6bbad74",
                "reference": "d8b22cc3a159819fa2a4bbd1c7aad026c6bbad74",
                "shasum": ""
            },
            "require": {
                "php": "^5.5|^7.0",
                "symfony/framework-bundle": "^3.4|^4.0"
            },
            "require-dev": {
                "phpspec/phpspec": "^2.5"
            },
            "type": "symfony-bundle",
            "autoload": {
                "psr-4": {
                    "Toiba\\FullCalendarBundle\\": ""
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Rebeca Mora Anca",
                    "email": "anca.rebeca@gmail.com",
                    "role": "Developer"
                },
                {
                    "name": "Théo Attali",
                    "email": "theoattali@gmail.com",
                    "role": "Developer"
                }
            ],
            "description": "Symfony integration of FullCalendar.js library. Events can be stored with Doctrine, MongoDB, CouchDB and others",
            "homepage": "https://github.com/toiba/FullCalendarBundle",
            "keywords": [
                "calendar",
                "fullcalendar",
                "jquery calendar",
                "symfony calendar"
            ],
            "abandoned": "https://github.com/tattali/CalendarBundle",
            "time": "2018-08-09T18:06:32+00:00"
        }

这是 appkernel.php 中的包

public function registerBundles()
    {
        $bundles = [
...
new Toiba\FullCalendarBundle\FullCalendarBundle(),
...
];

你能帮帮我吗?

【问题讨论】:

  • 我对composer和git repo不太了解,所以我可能错了,但是尝试安装只读存储库是否正常?
  • 您是复制/粘贴缺少的班级声明还是将其输入?我问的原因是“FullCalend arBundle”中有一个空格。无论如何,请仔细检查 composer.json 并确认日历包没有以某种方式最终进入开发部分。
  • @Frankich 我不知道我在这里遵循了指南:packagist.org/packages/toiba/fullcalendar-bundle
  • @Cerad 空白是复制/粘贴错误,原始错误中没有空白。我的 composer.json 中没有 Fullcalendar 的任何引用,甚至在开发部分也没有
  • @MattZdj 所以听起来作曲家最初并未用于安装捆绑包。也许是从某个地方下载的 zip 文件。要么使用“composer require toiba/fullcalendar-bundle”,要么,因为它已被贬值,所以使用维护包。

标签: php symfony fullcalendar bundle


【解决方案1】:

感谢@Cerad 和@Frankich,我能够让它工作。

我不得不执行

composer 需要 toiba/fullcalendar-bundle

正确安装,然后

composer install --no-dev

命令很好地唤醒了!

非常感谢。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-29
    • 2017-03-23
    • 2021-10-03
    相关资源
    最近更新 更多