我的应用程序在开发中运行良好。当我运行生产版本时,build / lib / www / app文件夹中缺少app.js。任何人都可以提供一些有关如何追踪构建错误的见解吗?
感谢。
更新: 我遍历了所有gulpfile,试图了解发生了什么,最后得到了在资产结束时调用的构建函数:prod任务。在该函数中,我替换了行
中的templates变量.pipe(gulpIf('** / app.js',footer(templates)))
使用测试字符串并且它可以工作。所以现在我要解决许多模板导致问题的原因。太痛苦了。有没有办法让gulp给你一些信息,比如发生错误的地方附近的一些字符?
./gradlew -Pprod clean bootRepackage
Starting a Gradle Daemon (subsequent builds will be faster)
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at gatling_b4a4yvzsw9z41nm1decp5w4n3.run(/Users/jreymann/projects-java/us.netblue/gradle/gatling.gradle:23)
:clean
:cleanResources UP-TO-DATE
:bootBuildInfo
:bower
:nodeSetup SKIPPED
:npmSetup SKIPPED
:npmInstall UP-TO-DATE
:gulpBuildWithOpts
[12:29:58] Using gulpfile ~/projects-java/us.netblue/gulpfile.js
[12:29:58] Starting 'clean'...
[12:29:58] Finished 'clean' after 4.63 ms
[12:29:58] Starting 'build'...
[12:29:58] Starting 'copy:fonts'...
[12:29:58] Starting 'copy:common'...
[12:29:58] Starting 'inject:vendor'...
[12:29:58] Starting 'ngconstant:prod'...
[12:29:58] Finished 'ngconstant:prod' after 23 ms
[12:29:58] gulp-inject 1 files into vendor.scss.
[12:29:58] Finished 'copy:common' after 78 ms
[12:29:58] gulp-inject 19 files into index.html.
[12:29:58] Finished 'inject:vendor' after 79 ms
[12:29:58] Finished 'copy:fonts' after 98 ms
[12:29:58] Starting 'copy'...
[12:29:58] Finished 'copy' after 19 μs
[12:29:58] Starting 'inject:app'...
[12:29:58] gulp-inject 143 files into index.html.
[12:29:58] Finished 'inject:app' after 168 ms
[12:29:58] Starting 'inject:troubleshoot'...
[12:29:58] gulp-inject Nothing to inject into index.html.
[12:29:58] Finished 'inject:troubleshoot' after 2.07 ms
[12:29:58] Starting 'images'...
[12:29:58] Starting 'sass'...
[12:29:58] Starting 'html'...
[12:29:58] Starting 'copy:swagger'...
[12:29:58] Starting 'copy:images'...
[12:29:58] Finished 'copy:images' after 8.98 ms
[12:29:59] Tested 18 tests, 18 passes, 0 failures: PASS
[12:29:59] gulp-imagemin: Minified 6 images (saved 6.79 kB - 17%)
[12:29:59] Finished 'images' after 459 ms
[12:29:59] Finished 'sass' after 492 ms
[12:29:59] Starting 'styles'...
[12:29:59] Finished 'styles' after 2.21 ms
[12:29:59] Finished 'html' after 527 ms
[12:29:59] Finished 'copy:swagger' after 527 ms
[12:29:59] Starting 'assets:prod'...
[12:30:12] Finished 'assets:prod' after 13 s
[12:30:12] Finished 'build' after 14 s
:processResources
:compileJava
[Fatal Error] shrinkwrap-descriptors-bom-2.0.0-alpha-3.pom:130:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
[Fatal Error] shrinkwrap-descriptors-bom-2.0.0-alpha-3.pom:130:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
[Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
[Fatal Error] commons-parent-39.pom:1506:5: The markup in the document following the root element must be well-formed.
[Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
[Fatal Error] commons-parent-39.pom:1506:5: The markup in the document following the root element must be well-formed.
[Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
:compileScala UP-TO-DATE
:classes
:findMainClass
:war
[Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
[Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
:bootRepackage
BUILD SUCCESSFUL
如果我单独运行gulp构建,我会得到:
gulp build
[12:05:12] Using gulpfile ~/projects-java/us.netblue/gulpfile.js
[12:05:12] Starting 'clean'...
[12:05:12] Finished 'clean' after 21 ms
[12:05:12] Starting 'build'...
[12:05:12] Starting 'copy:fonts'...
[12:05:12] Starting 'copy:common'...
[12:05:12] Starting 'inject:vendor'...
[12:05:12] Starting 'ngconstant:prod'...
[12:05:12] Finished 'ngconstant:prod' after 25 ms
[12:05:12] gulp-inject 1 files into vendor.scss.
[12:05:12] Finished 'copy:common' after 80 ms
[12:05:12] gulp-inject 19 files into index.html.
[12:05:12] Finished 'inject:vendor' after 80 ms
[12:05:12] Finished 'copy:fonts' after 104 ms
[12:05:12] Starting 'copy'...
[12:05:12] Finished 'copy' after 24 μs
[12:05:12] Starting 'inject:app'...
[12:05:13] gulp-inject 143 files into index.html.
[12:05:13] Finished 'inject:app' after 179 ms
[12:05:13] Starting 'inject:troubleshoot'...
[12:05:13] gulp-inject Nothing to inject into index.html.
[12:05:13] Finished 'inject:troubleshoot' after 2.19 ms
[12:05:13] Starting 'images'...
[12:05:13] Starting 'sass'...
[12:05:13] Starting 'html'...
[12:05:13] Starting 'copy:swagger'...
[12:05:13] Starting 'copy:images'...
[12:05:13] Finished 'copy:images' after 7.44 ms
[12:05:13] Tested 18 tests, 18 passes, 0 failures: PASS
[12:05:13] gulp-imagemin: Minified 6 images (saved 6.79 kB - 17%)
[12:05:13] Finished 'images' after 439 ms
[12:05:13] Finished 'sass' after 483 ms
[12:05:13] Starting 'styles'...
[12:05:13] Finished 'styles' after 1.42 ms
[12:05:13] Finished 'html' after 511 ms
[12:05:13] Finished 'copy:swagger' after 514 ms
[12:05:13] Starting 'assets:prod'...
[12:05:26] gulp-notify: [JHipster Gulp Build] Error: Unexpected token .
[12:05:26] Finished 'assets:prod' after 13 s
[12:05:26] Finished 'build' after 14 s
答案 0 :(得分:1)
在一次尝试每个模板几个小时后,我终于发现问题是模板中的拼写错误,其中有$而不是$。这在构建函数中的JS相关子任务中引发了一个模糊的错误。
答案 1 :(得分:1)
如果你打开gulpfile.js,就会有一个名为'html'的gulp任务。 如果您通过输入“gulp html”从终端运行此任务,它将在'target / tmp'中生成名为'templates.js'的文件文件夹。 此文件包含多个 $ templateCache.put 行。 其中一行可能导致错误。 在 PROD配置文件中运行您的应用程序并保持服务器正常运行。
删除几乎所有的$ templateCache.put行,除了templates.js中的主页行,并运行'gulp build'。 现在很难引用浏览器并检查您是否能够看到主页。 如果主页和其他行未导致错误,您将看到主页。
现在将一些已删除的$ templateCache.put行添加回templates.js并再次运行'gulp build'。
重复此过程,直到您解决导致问题的行。
一旦你发现该行检查它提到的html页面并尝试删除该html文件中的所有注释。
该html文件中的某些代码可能会导致此问题。
希望这有帮助。