dongwo5449 2019-01-28 19:19
浏览 263

Symfony 4,迁移到生产,命令“composer install --no-dev”失败(ClassNotFoundException:WebProfilerBundle)

En dev environment when I run the command composer install I haven't any problem. I want to deploy my symfony app in an another server (a prod server), however, when I run the command composer install --no-dev I get an error and I don't find/understand what is the problem.

The logs are :

Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 118 installs, 0 updates, 0 removals
  - Installing ocramius/package-versions (1.3.0): Loading from cache
  - Installing symfony/flex (v1.1.8): Loading from cache
  - Installing symfony/yaml (v4.1.10): Loading from cache
  - Installing symfony/finder (v4.1.10): Loading from cache
  - ...
  - Installing symfony/web-link (v4.1.10): Loading from cache
  - Installing symfony/asset (v4.1.10): Loading from cache
  - Installing symfony/webpack-encore-pack (v1.0.3): Loading from cache
Generating autoload files
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "WebProfilerBundle" from namespace "Symfony\Bundle\WebProfilerBundle".
!!  Did you forget a "use" statement for another namespace? in /var/www/myapp/src/Kernel.php:33
!!  Stack trace:
!!  #0 /var/www/myapp/vendor/symfony/http-kernel/Kernel.php(405): App\Kernel->registerBundles()
!!  #1 /var/www/myapp/vendor/symfony/http-kernel/Kernel.php(120): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!!  #2 /var/www/myapp/vendor/symfony/framework-bundle/Console/Application.php(65): Symfony\Component\HttpKernel\Kernel->boot()
!!  #3 /var/www/myapp/vendor/symfony/console/Application.php(145): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!!  #4 /var/www/myapp/bin/console(39): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
!!  #5 {main}
!!    thrown in /var/www/myapp/src/Kernel.php on line 33
!!  
Script @auto-scripts was called via post-install-cmd

My composer.json :

{
    "type": "project",
    "license": "proprietary",
    "require": {
        "php": "^7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "codeception/codeception": "^2.5",
        "doctrine/doctrine-fixtures-bundle": "^3.0",
        "friendsofsymfony/jsrouting-bundle": "^2.2",
        "sensio/framework-extra-bundle": "^5.1",
        "symfony/apache-pack": "^1.0",
        "symfony/asset": "*",
        "symfony/console": "*",
        "symfony/dotenv": "*",
        "symfony/expression-language": "*",
        "symfony/flex": "^1.1",
        "symfony/form": "*",
        "symfony/framework-bundle": "*",
        "symfony/monolog-bundle": "^3.1",
        "symfony/orm-pack": "*",
        "symfony/process": "*",
        "symfony/security-bundle": "*",
        "symfony/serializer-pack": "*",
        "symfony/swiftmailer-bundle": "^3.1",
        "symfony/twig-bundle": "*",
        "symfony/validator": "*",
        "symfony/web-link": "*",
        "symfony/webpack-encore-pack": "^1.0",
        "symfony/yaml": "*"
    },
    "require-dev": {
        "symfony/debug-pack": "*",
        "symfony/maker-bundle": "^1.0",
        "symfony/profiler-pack": "*",
        "symfony/test-pack": "^1.0",
        "symfony/web-server-bundle": "*"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "paragonie/random_compat": "2.*",
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php56": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "4.1.*"
        }
    }
}

Thanks for any help/tips ! I'm not a great composer user :/

Edit, the complete output of the command composer install --no-dev :

Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 118 installs, 0 updates, 0 removals
  - Installing ocramius/package-versions (1.3.0): Loading from cache
  - Installing symfony/flex (v1.1.8): Loading from cache
  - Installing symfony/yaml (v4.1.10): Loading from cache
  - Installing symfony/finder (v4.1.10): Loading from cache
  - Installing symfony/event-dispatcher (v4.1.10): Loading from cache
  - Installing symfony/polyfill-mbstring (v1.10.0): Loading from cache
  - Installing symfony/dom-crawler (v4.1.10): Loading from cache
  - Installing symfony/css-selector (v4.1.10): Loading from cache
  - Installing symfony/console (v4.1.10): Loading from cache
  - Installing symfony/browser-kit (v4.1.10): Loading from cache
  - Installing ralouphie/getallheaders (2.0.5): Loading from cache
  - Installing psr/http-message (1.0.1): Loading from cache
  - Installing guzzlehttp/psr7 (1.5.2): Loading from cache
  - Installing guzzlehttp/promises (v1.3.1): Loading from cache
  - Installing guzzlehttp/guzzle (6.3.3): Loading from cache
  - Installing symfony/process (v4.1.10): Loading from cache
  - Installing facebook/webdriver (1.6.0): Loading from cache
  - Installing sebastian/version (2.0.1): Loading from cache
  - Installing sebastian/resource-operations (2.0.1): Loading from cache
  - Installing sebastian/recursion-context (3.0.0): Loading from cache
  - Installing sebastian/object-reflector (1.1.1): Loading from cache
  - Installing sebastian/object-enumerator (3.0.3): Loading from cache
  - Installing sebastian/global-state (2.0.0): Loading from cache
  - Installing sebastian/exporter (3.1.0): Loading from cache
  - Installing sebastian/environment (4.0.1): Loading from cache
  - Installing sebastian/diff (3.0.1): Loading from cache
  - Installing sebastian/comparator (3.0.2): Loading from cache
  - Installing phpunit/php-timer (2.0.0): Loading from cache
  - Installing phpunit/php-text-template (1.2.1): Loading from cache
  - Installing phpunit/php-file-iterator (2.0.2): Loading from cache
  - Installing theseer/tokenizer (1.1.0): Loading from cache
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
  - Installing phpunit/php-token-stream (3.0.1): Loading from cache
  - Installing phpunit/php-code-coverage (6.1.4): Loading from cache
  - Installing webmozart/assert (1.4.0): Loading from cache
  - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
  - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
  - Installing phpdocumentor/reflection-docblock (4.3.0): Loading from cache
  - Installing doctrine/instantiator (1.1.0): Loading from cache
  - Installing phpspec/prophecy (1.8.0): Loading from cache
  - Installing phar-io/version (2.0.1): Loading from cache
  - Installing phar-io/manifest (1.0.3): Loading from cache
  - Installing myclabs/deep-copy (1.8.1): Loading from cache
  - Installing phpunit/phpunit (7.5.2): Loading from cache
  - Installing codeception/stub (2.0.4): Loading from cache
  - Installing codeception/phpunit-wrapper (7.6.1): Loading from cache
  - Installing behat/gherkin (v4.6.0): Loading from cache
  - Installing codeception/codeception (2.5.2): Loading from cache
  - Installing doctrine/lexer (v1.0.1): Loading from cache
  - Installing doctrine/annotations (v1.6.0): Loading from cache
  - Installing doctrine/reflection (v1.0.0): Loading from cache
  - Installing doctrine/event-manager (v1.0.0): Loading from cache
  - Installing doctrine/collections (v1.5.0): Loading from cache
  - Installing doctrine/cache (v1.8.0): Loading from cache
  - Installing doctrine/persistence (v1.1.0): Loading from cache
  - Installing doctrine/inflector (v1.3.0): Loading from cache
  - Installing doctrine/common (v2.10.0): Loading from cache
  - Installing symfony/doctrine-bridge (v4.1.10): Loading from cache
  - Installing doctrine/doctrine-cache-bundle (1.3.5): Loading from cache
  - Installing symfony/routing (v4.1.10): Loading from cache
  - Installing symfony/http-foundation (v4.1.10): Loading from cache
  - Installing psr/log (1.1.0): Loading from cache
  - Installing symfony/debug (v4.1.10): Loading from cache
  - Installing symfony/http-kernel (v4.1.10): Loading from cache
  - Installing symfony/filesystem (v4.1.10): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing symfony/dependency-injection (v4.1.10): Loading from cache
  - Installing symfony/config (v4.1.10): Loading from cache
  - Installing psr/simple-cache (1.0.1): Loading from cache
  - Installing psr/cache (1.0.1): Loading from cache
  - Installing symfony/cache (v4.1.10): Loading from cache
  - Installing symfony/framework-bundle (v4.1.10): Loading from cache
  - Installing jdorn/sql-formatter (v1.2.17): Loading from cache
  - Installing doctrine/dbal (v2.9.2): Loading from cache
  - Installing doctrine/doctrine-bundle (1.10.1): Loading from cache
  - Installing doctrine/data-fixtures (v1.3.1): Loading from cache
  - Installing doctrine/doctrine-fixtures-bundle (3.1.0): Loading from cache
  - Installing symfony/stopwatch (v4.1.10): Loading from cache
  - Installing zendframework/zend-eventmanager (3.2.1): Loading from cache
  - Installing zendframework/zend-code (3.3.1): Loading from cache
  - Installing ocramius/proxy-manager (2.2.2): Loading from cache
  - Installing doctrine/migrations (v2.0.0): Loading from cache
  - Installing egulias/email-validator (2.1.7): Loading from cache
  - Installing willdurand/jsonp-callback-validator (v1.1.0): Loading from cache
  - Installing symfony/serializer (v4.1.10): Loading from cache
  - Installing friendsofsymfony/jsrouting-bundle (2.2.2): Loading from cache
  - Installing sensio/framework-extra-bundle (v5.2.4): Loading from cache
  - Installing symfony/apache-pack (v1.0.1): Loading from cache
  - Installing symfony/dotenv (v4.1.10): Loading from cache
  - Installing symfony/expression-language (v4.1.10): Loading from cache
  - Installing symfony/inflector (v4.1.10): Loading from cache
  - Installing symfony/property-access (v4.1.10): Loading from cache
  - Installing symfony/options-resolver (v4.1.10): Loading from cache
  - Installing symfony/intl (v4.1.10): Loading from cache
  - Installing symfony/polyfill-intl-icu (v1.10.0): Loading from cache
  - Installing symfony/form (v4.1.10): Loading from cache
  - Installing monolog/monolog (1.24.0): Loading from cache
  - Installing symfony/monolog-bridge (v4.1.10): Loading from cache
  - Installing symfony/monolog-bundle (v3.3.1): Loading from cache
  - Installing doctrine/orm (v2.6.3): Loading from cache
  - Installing doctrine/doctrine-migrations-bundle (v2.0.0): Loading from cache
  - Installing symfony/orm-pack (v1.0.6): Loading from cache
  - Installing symfony/security (v4.1.10): Loading from cache
  - Installing symfony/security-bundle (v4.1.10): Loading from cache
  - Installing symfony/property-info (v4.1.10): Loading from cache
  - Installing symfony/serializer-pack (v1.0.2): Loading from cache
  - Installing swiftmailer/swiftmailer (v6.1.3): Loading from cache
  - Installing symfony/swiftmailer-bundle (v3.2.5): Loading from cache
  - Installing twig/twig (v2.6.2): Loading from cache
  - Installing symfony/twig-bridge (v4.1.10): Loading from cache
  - Installing symfony/twig-bundle (v4.1.10): Loading from cache
  - Installing symfony/translation (v4.1.10): Loading from cache
  - Installing symfony/validator (v4.1.10): Loading from cache
  - Installing psr/link (1.0.0): Loading from cache
  - Installing fig/link-util (1.0.0): Loading from cache
  - Installing symfony/web-link (v4.1.10): Loading from cache
  - Installing symfony/asset (v4.1.10): Loading from cache
  - Installing symfony/webpack-encore-pack (v1.0.3): Loading from cache
Generating autoload files
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "WebProfilerBundle" from namespace "Symfony\Bundle\WebProfilerBundle".
!!  Did you forget a "use" statement for another namespace? in /var/www/symepty/src/Kernel.php:33
!!  Stack trace:
!!  #0 /var/www/symepty/vendor/symfony/http-kernel/Kernel.php(405): App\Kernel->registerBundles()
!!  #1 /var/www/symepty/vendor/symfony/http-kernel/Kernel.php(120): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!!  #2 /var/www/symepty/vendor/symfony/framework-bundle/Console/Application.php(65): Symfony\Component\HttpKernel\Kernel->boot()
!!  #3 /var/www/symepty/vendor/symfony/console/Application.php(145): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!!  #4 /var/www/symepty/bin/console(39): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
!!  #5 {main}
!!    thrown in /var/www/symepty/src/Kernel.php on line 33
!!  
Script @auto-scripts was called via post-install-cmd
  • 写回答

3条回答 默认 最新

  • dongpu2694 2019-01-28 20:59
    关注

    Check what bundles are activated in prod environment.

    see: config/bundles.php file

    and you should see some as:

    return [
    ...
    Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
    ...
    ]
    
    评论

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况