首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JHipster gulp不为生产生成app.js

JHipster gulp不为生产生成app.js
EN

Stack Overflow用户
提问于 2016-12-28 20:38:02
回答 2查看 1.3K关注 0票数 4

我的应用程序在开发中运行良好。当我运行生产构建时,build/lib/www/app文件夹中缺少app.js。有人能提供一些关于如何追踪我的构建的错误的洞察力吗?

谢谢。

更新:我浏览了所有的gulpfile文件,试图了解发生了什么,并最终得到了在资产:prod任务结束时调用的构建函数。在该函数中,我替换了行中的模板变量。

.pipe(gulpIf('**/app.js',脚注(模板)

有一个测试字符串,它可以工作。所以现在我要找出导致这个问题的是哪一个模板。好痛啊。有什么方法可以让你大吃一惊,给你一些更多的信息,如一些字符附近的错误发生的地方?

代码语言:javascript
复制
./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,我会得到:

代码语言:javascript
复制
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
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-12-29 10:25:46

经过几个小时的一次一次地尝试每个模板,我终于发现了一个问题,就是在一个模板中出现了一个错误,其中有一个$而不是$。这在构建函数中的JS相关子任务中抛出了一个模糊错误。

票数 4
EN

Stack Overflow用户

发布于 2018-01-22 09:20:25

如果打开gulpfile.js,就会有一个名为'html‘的gulp任务。如果您通过键入'templates.js'“gulp”从终端运行此任务,那么它将在'target/tmp'文件夹中生成一个名为的文件。该文件有多个$templateCache.put行。其中一行可能会导致错误。在 profile中运行您的应用程序,并保持服务器运行。

删除几乎所有的$templateCache.put行,除了templates.js中的主页行,并运行'gulp‘。现在,硬引用浏览器,并检查您是否能够看到主页。如果主页和其他行没有导致错误,您将看到主页。

现在,将一些已删除的$templateCache.put行添加回templates.js,并再次运行'gulp‘。

重复此过程,直到对引起问题的行进行精细处理。

找到这一行后,检查它提到的html页面,然后尝试删除该html文件中的所有注释。

该html文件中的一些代码可能会导致问题。

希望这能有所帮助。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41369380

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档