找不到条目“虚拟” ... EntrypointLookup.php

时间:2019-03-03 11:11:35

标签: symfony

我有一个奇怪的问题...

我创建一个新的Symfony项目:

composer create-project symfony/skeleton Vikings

然后我安装了encore(bootstrap,jquery,poppers.js)

composer require encore
yarn install
yarn add bootstrap --dev
yarn add jquery popper.js --dev

我为引导程序设置了app.js和app.scss并运行:

yarn encore dev

有5个文件:

public/build/app.css
public/build/app.js
public/build/entrypoints.json
public/build/manifest.json
public/build/runtime.js
public/build/vendors~app.js

但是现在我跑步

php bin/console cache:clear

遇到此错误:

// Clearing the cache for the dev environment with debug true

 // Clearing outdated warmup directory...

 // Warming up cache...


In EntrypointLookup.php line 86:

  [Symfony\WebpackEncoreBundle\Exception\EntrypointNotFoundException]
  Could not find the entry "dummy" in "/Users/lukahome/Projects/Vikings/public/build/entrypoints.json". Found: entrypoints.


Exception trace:
 () at /Users/lukahome/Projects/Vikings/vendor/symfony/webpack-encore-bundle/src/Asset/EntrypointLookup.php:86
 Symfony\WebpackEncoreBundle\Asset\EntrypointLookup->validateEntryName() at /Users/lukahome/Projects/Vikings/vendor/symfony/webpack-encore-bundle/src/Asset/EntrypointLookup.php:59
 Symfony\WebpackEncoreBundle\Asset\EntrypointLookup->getEntryFiles() at /Users/lukahome/Projects/Vikings/vendor/symfony/webpack-encore-bundle/src/Asset/EntrypointLookup.php:41
 Symfony\WebpackEncoreBundle\Asset\EntrypointLookup->getJavaScriptFiles() at /Users/lukahome/Projects/Vikings/vendor/symfony/webpack-encore-bundle/src/CacheWarmer/EntrypointCacheWarmer.php:41
 Symfony\WebpackEncoreBundle\CacheWarmer\EntrypointCacheWarmer->doWarmUp() at /Users/lukahome/Projects/Vikings/vendor/symfony/framework-bundle/CacheWarmer/AbstractPhpFileCacheWarmer.php:51
 Symfony\Bundle\FrameworkBundle\CacheWarmer\AbstractPhpFileCacheWarmer->warmUp() at /Users/lukahome/Projects/Vikings/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php:96
 Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() at /Users/lukahome/Projects/Vikings/vendor/symfony/framework-bundle/Command/CacheClearCommand.php:194
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() at /Users/lukahome/Projects/Vikings/vendor/symfony/framework-bundle/Command/CacheClearCommand.php:129
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() at /Users/lukahome/Projects/Vikings/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /Users/lukahome/Projects/Vikings/vendor/symfony/console/Application.php:919
 Symfony\Component\Console\Application->doRunCommand() at /Users/lukahome/Projects/Vikings/vendor/symfony/framework-bundle/Console/Application.php:89
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /Users/lukahome/Projects/Vikings/vendor/symfony/console/Application.php:262
 Symfony\Component\Console\Application->doRun() at /Users/lukahome/Projects/Vikings/vendor/symfony/framework-bundle/Console/Application.php:75
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Users/lukahome/Projects/Vikings/vendor/symfony/console/Application.php:145
 Symfony\Component\Console\Application->run() at /Users/lukahome/Projects/Vikings/bin/console:38

我稍微调试一下,发现'dummy'已在EntrypointCacheWarmer.php中进行了硬编码

protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
    {
        foreach ($this->cacheKeys as $cacheKey => $path) {
            // If the file does not exist then just skip past this entry point.
            if (!file_exists($path)) {
                continue;
            }

            $entryPointLookup = new EntrypointLookup($path, $arrayAdapter, $cacheKey);

            try {
                $entryPointLookup->getJavaScriptFiles('dummy');
            } catch (EntrypointNotFoundException $e) {
                // ignore exception
            }
        }
    }

如果我将“虚拟”更改为“应用”,则没有错误,但是我不知道这是否是正确的解决方案...

请帮助

3 个答案:

答案 0 :(得分:3)

这可能会有所帮助:https://github.com/symfony/webpack-encore-bundle/issues/47#issuecomment-468833014

好像他们忘了加:

use Symfony\WebpackEncoreBundle\Exception\EntrypointNotFoundException;

Symfony\WebpackEncoreBundle\CacheWarmer\EntrypointCacheWarmer.php

答案 1 :(得分:2)

所有内容均已在最新版本中修复!只需升级到v1.2.1。我们将添加一个集成测试来覆盖这一层,以避免将来出现问题。

干杯!

答案 2 :(得分:1)

我有同样的问题... 我想这是symfony的一个小疏忽。 我只是将app.js文件重命名为dummy.js并在webpack.config.js中重命名,直到symfony对其进行了修复