我已经用MEAN.io分叉并启动了一个项目,但我的webpack编译开始失败。这是我得到的错误。我知道它会在某处发现一些意外的令牌。但问题是我检查了所有文件,看起来还不错。事件IDE(Intellij)告诉我所有文件都是格式良好的。所以我认为这个错误是别的。
如果您想查看我的文件,here they are。
谢谢!
ERROR in Error: Child compilation failed:
Module build failed: SyntaxError: Unexpected token )
- lodash.js:14843
[mean.io]/[lodash]/lodash.js:14843:16
- lodash.js:494 apply
[mean.io]/[lodash]/lodash.js:494:27
- lodash.js:15227
[mean.io]/[lodash]/lodash.js:15227:16
- lodash.js:496 apply
[mean.io]/[lodash]/lodash.js:496:27
- lodash.js:6600
[mean.io]/[lodash]/lodash.js:6600:16
- lodash.js:14842 Function.template
[mean.io]/[lodash]/lodash.js:14842:20
- SyntaxError: Unexpected token )
- compiler.js:76
[mean.io]/[html-webpack-plugin]/lib/compiler.js:76:16
- Compiler.js:296 Compiler.<anonymous>
[mean.io]/[webpack]/lib/Compiler.js:296:10
- Compiler.js:499
[mean.io]/[webpack]/lib/Compiler.js:499:13
- Tapable.js:202 next
[mean.io]/[tapable]/lib/Tapable.js:202:11
- CachePlugin.js:62 Compiler.<anonymous>
[mean.io]/[webpack]/lib/CachePlugin.js:62:5
- Tapable.js:206 Compiler.applyPluginsAsyncSeries
[mean.io]/[tapable]/lib/Tapable.js:206:13
- Compiler.js:496
[mean.io]/[webpack]/lib/Compiler.js:496:10
- Tapable.js:195 Compilation.applyPluginsAsyncSeries
[mean.io]/[tapable]/lib/Tapable.js:195:46
- Compilation.js:649 self.applyPluginsAsync.err
[mean.io]/[webpack]/lib/Compilation.js:649:19
- Tapable.js:195 Compilation.applyPluginsAsyncSeries
[mean.io]/[tapable]/lib/Tapable.js:195:46
- Compilation.js:640 self.applyPluginsAsync.err
[mean.io]/[webpack]/lib/Compilation.js:640:11
- Tapable.js:202 next
[mean.io]/[tapable]/lib/Tapable.js:202:11
- UglifyJsPlugin.js:230 Compilation.compilation.plugin
[mean.io]/[webpack]/lib/optimize/UglifyJsPlugin.js:230:5
- Tapable.js:206 Compilation.applyPluginsAsyncSeries
[mean.io]/[tapable]/lib/Tapable.js:206:13
- Compilation.js:635 self.applyPluginsAsync.err
[mean.io]/[webpack]/lib/Compilation.js:635:10
- Tapable.js:195 Compilation.applyPluginsAsyncSeries
[mean.io]/[tapable]/lib/Tapable.js:195:46
- Compilation.js:631 sealPart2
[mean.io]/[webpack]/lib/Compilation.js:631:9
- Tapable.js:195 Compilation.applyPluginsAsyncSeries
[mean.io]/[tapable]/lib/Tapable.js:195:46
- Compilation.js:579 Compilation.seal
[mean.io]/[webpack]/lib/Compilation.js:579:8
- Compiler.js:493
[mean.io]/[webpack]/lib/Compiler.js:493:16
- Tapable.js:289
[mean.io]/[tapable]/lib/Tapable.js:289:11
- Compilation.js:481 _addModuleChain
[mean.io]/[webpack]/lib/Compilation.js:481:11
- Compilation.js:452 processModuleDependencies.err
[mean.io]/[webpack]/lib/Compilation.js:452:13
- next_tick.js:73 _combinedTickCallback
internal/process/next_tick.js:73:7
- next_tick.js:104 process._tickCallback
internal/process/next_tick.js:104:9
Child html-webpack-plugin for "index.html":
[/EZv] ./~/html-webpack-plugin/lib/loader.js!./src/index.hbs 785 bytes {0} [built] [failed] [1 error]
factory:27ms building:21ms = 48ms
ERROR in ./~/html-webpack-plugin/lib/loader.js!./src/index.hbs
Module build failed: SyntaxError: Unexpected token )
at /Users/pablo/workspace/test-projects/mean.io/node_modules/lodash/lodash.js:14843:16
at apply (/Users/pablo/workspace/test-projects/mean.io/node_modules/lodash/lodash.js:494:27)
at /Users/pablo/workspace/test-projects/mean.io/node_modules/lodash/lodash.js:15227:16
at apply (/Users/pablo/workspace/test-projects/mean.io/node_modules/lodash/lodash.js:496:27)
at /Users/pablo/workspace/test-projects/mean.io/node_modules/lodash/lodash.js:6600:16
at Function.template (/Users/pablo/workspace/test-projects/mean.io/node_modules/lodash/lodash.js:14842:20)
at Object.module.exports (/Users/pablo/workspace/test-projects/mean.io/node_modules/html-webpack-plugin/lib/loader.js:32:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! landings-leadaki@1.0.0 webpack: `node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "config/webpack.prod.js" "--progress" "--profile" "--bail"`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the landings-leadaki@1.0.0 webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/pablo/.npm/_logs/2017-10-15T15_18_54_411Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! landings-leadaki@1.0.0 build:prod: `npm run clean:dist && npm run webpack -- --config config/webpack.prod.js --progress --profile --bail`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the landings-leadaki@1.0.0 build:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/pablo/.npm/_logs/2017-10-15T15_18_54_451Z-debug.log
答案 0 :(得分:0)
所以我终于找到了它,不能相信我没有看到这一点。 在我的index.hbs文件中,我不小心删除了关闭大括号和EJS&#39;如果&#39;声明
<% if (webpackConfig.htmlElements.headTags) { %>
<!-- Configured Head Tags -->
<%= webpackConfig.htmlElements.headTags %>
<% } %>
所以看起来虽然我使用了把手,但HtmlWebpackPlugin在内部使用了EJS模板并尝试解析它。这就是失踪的意外标记。