- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Symfony 4 确实在开发模式下构建,但在产生错误时不在生产模式下构建:
试图从命名空间加载类“WebProfilerBundle”。
WebProfilerBundle 确实已安装,但仅应在开发环境中使用,不应在生产版本中使用。
我在 Fedora30 上,不涉及容器化。
$ ls -l public/build
168 -rw-rw-r-- 1 rob rob 169693 31. Aug 15:39 0.376e4878.js
184 -rw-rw-r-- 1 rob rob 185359 31. Aug 15:39 0.6ea45216.css
4 -rw-rw-r-- 1 rob rob 404 31. Aug 15:39 app.00b96fcb.js
4 -rw-rw-r-- 1 rob rob 213 31. Aug 15:39 app.f7e93431.css
4 -rw-rw-r-- 1 rob rob 261 31. Aug 15:39 entrypoints.json
4 drwxrwxr-x 2 rob rob 4096 31. Aug 15:39 fonts
4 drwxrwxr-x 2 rob rob 4096 31. Aug 15:39 images
4 -rw-rw-r-- 1 rob rob 1246 31. Aug 15:39 manifest.json
4 -rw-rw-r-- 1 rob rob 1505 31. Aug 15:39 runtime.3c075ebb.js
<?php
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
];
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"sensio/framework-extra-bundle": "^5.4",
"symfony/apache-pack": "^1.0",
"symfony/asset": "4.3.*",
"symfony/console": "4.3.*",
"symfony/dotenv": "4.3.*",
"symfony/expression-language": "4.3.*",
"symfony/flex": "^1.4",
"symfony/form": "4.3.*",
"symfony/framework-bundle": "4.3.*",
"symfony/http-client": "4.3.*",
"symfony/intl": "4.3.*",
"symfony/monolog-bundle": "^3.4",
"symfony/orm-pack": "*",
"symfony/process": "4.3.*",
"symfony/security-bundle": "4.3.*",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "4.3.*",
"symfony/twig-bundle": "4.3.*",
"symfony/validator": "4.3.*",
"symfony/web-link": "4.3.*",
"symfony/webpack-encore-bundle": "^1.6",
"symfony/yaml": "4.3.*"
},
"require-dev": {
"symfony/debug-pack": "*",
"symfony/maker-bundle": "^1.0",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/web-server-bundle": "4.3.*"
},
"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.3.*"
}
}
}
cp .env.local.prod .env.local
这包含..APP_ENV=prod
rm -rf var/cache; rm -rf vendor
../composer.phar install --no-dev --prefer-dist --optimize-autoloader --no-interaction
yarn build
rm .env.local
完成构建 rm .env.local just use .env with APP_SECRET and APP_ENV=dev
rm -rf var/cache; rm -rf vendor
../composer.phar install
yarn encore dev
Attempted to load class "WebProfilerBundle" from namespace "Symfony\Bundle\WebProfilerBundle". Did you forget a "use" statement for another namespace?
(1/1) ClassNotFoundException
Attempted to load class "WebProfilerBundle" from namespace "Symfony\Bundle\WebProfilerBundle".
Did you forget a "use" statement for another namespace?
in Kernel.php line 23
at Kernel->registerBundles()
in Kernel.php line 424
at Kernel->initializeBundles()
in Kernel.php line 130
at Kernel->boot()
in Kernel.php line 193
at Kernel->handle(object(Request))
in index.php line 25
Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 92 installs, 0 updates, 0 removals
- Installing ocramius/package-versions (1.5.1): Loading from cache
- Installing symfony/flex (v1.4.5): Loading from cache
- Installing doctrine/lexer (1.1.0): Loading from cache
- Installing doctrine/annotations (v1.7.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.6.2): Loading from cache
- Installing doctrine/cache (v1.8.0): Loading from cache
- Installing doctrine/persistence (1.1.1): Loading from cache
- Installing doctrine/inflector (v1.3.0): Loading from cache
- Installing doctrine/common (v2.10.0): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing symfony/service-contracts (v1.1.5): Loading from cache
- Installing symfony/polyfill-mbstring (v1.12.0): Loading from cache
- Installing symfony/doctrine-bridge (v4.3.3): Loading from cache
- Installing doctrine/doctrine-cache-bundle (1.3.5): Loading from cache
- Installing doctrine/instantiator (1.2.0): Loading from cache
- Installing symfony/stopwatch (v4.3.3): Loading from cache
- Installing symfony/polyfill-php73 (v1.12.0): Loading from cache
- Installing symfony/console (v4.3.3): 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.3): Loading from cache
- Installing doctrine/dbal (v2.9.2): Loading from cache
- Installing doctrine/migrations (2.1.1): Loading from cache
- Installing egulias/email-validator (2.1.11): Loading from cache
- Installing jdorn/sql-formatter (v1.2.17): Loading from cache
- Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
- Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
- Installing symfony/polyfill-php72 (v1.12.0): Loading from cache
- Installing symfony/polyfill-intl-idn (v1.12.0): Loading from cache
- Installing symfony/mime (v4.3.3): Loading from cache
- Installing symfony/http-foundation (v4.3.3): Loading from cache
- Installing symfony/event-dispatcher-contracts (v1.1.5): Loading from cache
- Installing symfony/event-dispatcher (v4.3.3): Loading from cache
- Installing psr/log (1.1.0): Loading from cache
- Installing symfony/debug (v4.3.3): Loading from cache
- Installing symfony/http-kernel (v4.3.3): Loading from cache
- Installing symfony/routing (v4.3.3): Loading from cache
- Installing symfony/finder (v4.3.3): Loading from cache
- Installing symfony/filesystem (v4.3.3): Loading from cache
- Installing symfony/dependency-injection (v4.3.3): Loading from cache
- Installing symfony/config (v4.3.3): Loading from cache
- Installing symfony/var-exporter (v4.3.3): Loading from cache
- Installing psr/cache (1.0.1): Loading from cache
- Installing symfony/cache-contracts (v1.1.5): Loading from cache
- Installing symfony/cache (v4.3.3): Loading from cache
- Installing symfony/framework-bundle (v4.3.3): Loading from cache
- Installing sensio/framework-extra-bundle (v5.4.1): Loading from cache
- Installing symfony/apache-pack (v1.0.1): Loading from cache
- Installing symfony/dotenv (v4.3.3): Loading from cache
- Installing symfony/expression-language (v4.3.3): Loading from cache
- Installing symfony/inflector (v4.3.3): Loading from cache
- Installing symfony/property-access (v4.3.3): Loading from cache
- Installing symfony/options-resolver (v4.3.3): Loading from cache
- Installing symfony/intl (v4.3.3): Loading from cache
- Installing symfony/polyfill-intl-icu (v1.12.0): Loading from cache
- Installing symfony/form (v4.3.3): Loading from cache
- Installing symfony/http-client-contracts (v1.1.5): Loading from cache
- Installing symfony/http-client (v4.3.3): Loading from cache
- Installing monolog/monolog (1.24.0): Loading from cache
- Installing symfony/monolog-bridge (v4.3.3): Loading from cache
- Installing symfony/monolog-bundle (v3.4.0): Loading from cache
- Installing doctrine/orm (v2.6.3): Loading from cache
- Installing doctrine/doctrine-bundle (1.11.2): 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/process (v4.3.3): Loading from cache
- Installing symfony/security-core (v4.3.3): Loading from cache
- Installing symfony/security-http (v4.3.3): Loading from cache
- Installing symfony/security-guard (v4.3.3): Loading from cache
- Installing symfony/security-csrf (v4.3.3): Loading from cache
- Installing symfony/security-bundle (v4.3.3): Loading from cache
- Installing symfony/serializer (v4.3.3): Loading from cache
- Installing symfony/property-info (v4.3.3): Loading from cache
- Installing webmozart/assert (1.5.0): Loading from cache
- Installing phpdocumentor/reflection-docblock (4.3.1): Loading from cache
- Installing symfony/serializer-pack (v1.0.2): Loading from cache
- Installing swiftmailer/swiftmailer (v6.2.1): Loading from cache
- Installing symfony/swiftmailer-bundle (v3.2.8): Loading from cache
- Installing symfony/translation-contracts (v1.1.5): Loading from cache
- Installing symfony/translation (v4.3.3): Loading from cache
- Installing twig/twig (v2.11.3): Loading from cache
- Installing symfony/twig-bridge (v4.3.3): Loading from cache
- Installing symfony/twig-bundle (v4.3.3): Loading from cache
- Installing symfony/validator (v4.3.3): 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.3.3): Loading from cache
- Installing symfony/asset (v4.3.3): Loading from cache
- Installing symfony/webpack-encore-bundle (v1.6.2): Loading from cache
- Installing symfony/yaml (v4.3.3): Loading from cache
Generating optimized autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [OK]
Executing script assets:install public [OK]
yarn run v1.17.3
$ encore production --progress
Running webpack ...
98% after emitting SizeLimitsPlugin DONE Compiled successfully in 5450ms 1:09:20 PM
I 18 files written to public/build
Entrypoint app [big] = runtime.3c075ebb.js 0.6ea45216.css 0.376e4878.js app.f7e93431.css app.00b96fcb.js
Entrypoint _tmp_copy = runtime.3c075ebb.js
Done in 7.52s.
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
最佳答案
非常感谢@msg 解决了这个问题。我的期望是环境变量只对创建构建很重要,并且它们在某种程度上是静态的。但正如已经解释过的 here ,环境变量在运行时也很重要。所以因为我在build后删除了我的.env.local,运行时环境立即改回dev。
关于php - Symfony 4 不在生产环境中构建 : Attempted to load class "WebProfilerBundle" from namespace,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57710023/
我在使用 gradle 构建一个特定应用程序时遇到问题。该应用程序可以用 eclipse 编译和构建,它在平板电脑上运行良好。当我尝试使用 Gradle 构建它时,“compileDebugJava”
我有一个 C 程序,是一位离开的开发人员留给我的。我试图弄清楚他到底在做什么,并将软件重新安排成更合乎逻辑的东西,这样我就可以更轻松地构建它。我正在使用 CMake 构建,而他使用的是 Make。 有
我刚开始阅读“Pro Spring MVC with web flow”,它附带了一个我想遵循的代码示例。 我要什么 - 我想像书中那样构建应用程序,使用 Gradle 有什么问题 - 我没用过 Gr
我希望有人已经这样做了。我正在尝试为我的一个 angular 2 项目在 teamcity 中建立一个连续的构建。在做了一些研究之后,我按照以下步骤操作: 构建步骤 1:为 teamcity 安装 j
我有一个旧的 ASP.Net 网站解决方案,看起来像: 当我在 Visual Studio 中构建解决方案时,我得到以下输出: ------ Build started: Project: C:\..
我使用 gulp-usref、gulp-if、gulp-uglify、gulp-csso 和 gulp-file-include 来构建我的应用程序。除了 HTML 保持原样外,构建中的一切都运行良好
我正在使用 ionic2 开发内部移动应用程序。我可以通过以下方式成功构建 ios: ionic build ios and ionic build ios --prod 但当我这样做时,它一直失败
我是一位经验丰富的 .NET/C# 开发人员,但对这里的几乎所有技术/库(包括 SQL/DB 工作)都是新手。 我正在开发一个具有 Azure/Entity Framework .NET 后端和可移植
我正在使用 VS 2008。我可以使用 IDE 成功编译我的解决方案。但是,当我尝试使用 devenv.com 构建它时,它失败并提示“错误:找不到项目输出组'(无法确定名称)的输出”。该组、其配置或
版本: ember.js 2.7,ember-data 2.7 ember-cli 2.9.1//同样适用于 ember-cli 2.7 node 6.9.1, npm 3.10.9//也适用于 no
我第一次修补 AzureDevops,设置一些 CI 任务。 我有一个公共(public)存储库(开源)和一个包含 3 个 F# 项目的解决方案(.sln)。该解决方案在 Windows/Mac/Li
目前 5.1.5 版本或 STLPort CVS 存储库似乎仍不支持 VS2008。如果有人已经完成了这项工作,那么如果可能的话,分享会很有用:) 同样,了解 VS2005 或 2008 x64 构建
我有一个 Python 2.7 项目,到目前为止一直使用 gfortran 和 MinGW 来构建扩展。我使用 MinGW,因为它似乎支持 Fortran 代码中的写入语句和可分配数组,而 MSVC
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题? Update the question所以它是on-topic对于堆栈溢出。 9年前关闭。 Improve this que
我想知道为什么在 Zimbra Wiki 中只列出了构建过程的特定平台。这意味着不可能在其他 Linux 发行版上构建 Zimbra? Zimbra 社区选择一个特殊的 Linux 发行版来构建 Zi
我将在 Swift 中构建一个 CLI 工具。我用这个命令创建了项目 swift package init --type executable当我构建我的项目并解析 时读取别名 Xcode 中的参数并
我想为添加到 docker 镜像的文件设置文件权限。我有这个简单的 Dockerfile: FROM ubuntu:utopic WORKDIR /app RUN groupadd -g 1000 b
当我使用 clBuildProgram在我的 OpenCl 代码中,它失败并显示错误代码 -11,没有任何日志信息。 这是我的代码的样子: ret = clBuildProgram(program
我有一个底部导航栏,它有一个列表页面,该页面使用状态块。 class _MainPageState extends State { int _index = 0; @override Wi
我在本地计算机上使用Jenkins(Jenkins URL未通过Internet公开,但该计算机上已启用Internet。) 我进行了以下配置更改: 在Jenkins工具上安装了Git和Github插
我是一名优秀的程序员,十分优秀!