My application runs fine in development. When I run the production build, app.js is missing from the build/lib/www/app folder. Could anyone offer some insight on how to track down what is going wrong with my build?
Thanks.
Update:
I walked through all the gulpfile trying to understand what was going on and finally got to the build function called at the end of the assets:prod task. Within that function I replaced the templates variable in the line
.pipe(gulpIf('**/app.js', footer(templates)))
with a test string and it works. So now I'm down to working out which template of many is causing the problem. What a pain. Is there a way to get gulp to give you a little more info such as some of the chars near where the error occurred?
./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
If I run the gulp build individually I get:
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
After some hours of trying each template one at a time, I finally found the problem as being a typo in a template where there was a $ instead of $. That threw an the vague error in the JS related subtask in the build function.
If you open gulpfile.js there is a gulp task called 'html'.
If you run this task from the terminal by typing "gulp html" it will generate a file called 'templates.js' in 'target/tmp' folder.
This file has multiple $templateCache.put lines.
One of those lines maybe causing the error.
Run your application in PROD profile and keep the server running.
Delete almost all of the $templateCache.put lines except for homepage line in templates.js and run 'gulp build'.
Now hard refersh the browser and check if you are able to see the homepage.
If the homepage and the other lines are not causing the error you will see the homepage.
Now add back some of those deleted $templateCache.put lines to templates.js and run 'gulp build' again.
Repeat this process till you fine the line that is causing the issue.
Once you find out that line check the html page it mentions and try and remove all comments in that html file.
Some code in that html file maybe causing the issue.
Hope this helps.
Related
Whenever I run gulp serve in Windows PowerShell, I keep getting stuck on the same part. 'Configure-webpack' stays stagnant until it times out 15 minutes later and cancels the request. Any idea why this is happening? The code from running 'gulp serve' in PowerShell is below.
[12:11:23] Finished subtask 'sass' after 666 ms
[12:11:23] Starting subtask 'lint'...
[12:11:23] [lint] eslint version: 8.7.0
[12:11:23] Starting subtask 'tsc'...
[12:11:23] [tsc] typescript version: 4.5.5
Request: '/temp/manifests.js'
[12:11:28] Finished subtask 'tsc' after 5.36 s
[12:11:30] Finished subtask 'lint' after 7.4 s
[12:11:32] Finished subtask 'copy-static-assets' after 9.18 s
[12:11:32] Starting subtask 'post-copy'...
[12:11:32] Finished subtask 'post-copy' after 182 μs
[12:11:32] Starting subtask 'configure-webpack'...
I've tried looking for help everywhere online and I can't find someone that has solved the same problem.
I'm using this Microsoft guide to try to build a SharePoint extension and it's working fine, but for the past few days, I've noticed that gulp serve stops functioning overnight.
https://learn.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/build-a-hello-world-extension
[06:39:41] Using gulpfile ~\Documents\repos\helloSPFXReal\gulpfile.js
[06:39:41] Starting 'serve'...
[06:39:41] Starting gulp
[06:39:41] Starting subtask 'spfx-serve'...
[06:39:41] [spfx-serve] To load your scripts, use this query string: ?debug=true&noredir=true&debugManifestsFile=https://localhost:4321/temp/manifests.js
[06:39:43] Starting server...
[06:39:43] Finished subtask 'spfx-serve' after 1.46 s
[06:39:43] Starting subtask 'pre-copy'...
[06:39:43] Finished subtask 'pre-copy' after 117 ms
[06:39:43] Starting subtask 'copy-static-assets'...
[06:39:43] Starting subtask 'sass'...
[06:39:43] Server started https://localhost:4321
[06:39:43] LiveReload started on port 35729
[06:39:43] Running server
[06:39:43] Finished subtask 'sass' after 44 ms
[06:39:43] Starting subtask 'lint'...
[06:39:43] [lint] eslint version: 7.12.1
[06:39:43] Starting subtask 'tsc'...
[06:39:43] [tsc] typescript version: 4.5.5
[06:39:43] Finished subtask 'copy-static-assets' after 329 ms
[06:39:46] 'serve' errored after 4.78 s
[06:39:46] Error: UNKNOWN: unknown error, stat 'C:\Users\bork\Documents\Working\repos\helloSPFXReal\node_modules\postcss-modules-local-by-default'
About to exit with code: 1
Process terminated before summary could be written, possible error in async code not continuing!
Trying to exit with exit code 1
I was following the guide yesterday and it worked perfectly, I stopped for the day intending to pick up where I left off and it's suddenly erroring. This happened yesterday as well, but I just rebuilt the project from scratch to resolve it.
I tried closing the browser completely, CTRL+f5 to reload, logging out and back in for the sharepoint test page I'm using... no difference. I tried running gulp trust-dev-cert again and gulp serve --nobrowser and no change.
I can start a new project again today, but it's going to quickly become problematic having to rebuild my projects like Groundhog Day. What is going on?
i am new for nodejs, in my hybris project, first i installed nodejs, run 'npm install','npm i cross-env' commands, when i run the command 'npm run hybris' from node_module folder, i got some errors can you provide any solution.
C:\Atlas_Insta\hybris\bin\custom\rodanandfields\rodanandfieldsstorefront\FE-Develop>npm run hybris
> RodanAndFields#1.0.0 hybris C:\Atlas_Insta\hybris\bin\custom\rodanandfields\rodanandfieldsstorefront\FE-Develop
> cross-env NODE_ENV=production gulp hybris-build
[15:29:07] Using gulpfile C:\Atlas_Insta\hybris\bin\custom\rodanandfields\rodanandfieldsstorefront\FE-Develop\gulpfile.js
[15:29:07] Starting 'clean'...
[15:29:07] Finished 'clean' after 128 ms
[15:29:07] Starting 'markupCompile'...
[15:29:08] Starting 'sass'...
[15:29:09] Finished 'sass' after 615 ms
[15:29:09] Starting 'js'...
[15:29:09] Finished 'js' after 129 ms
[15:29:09] Starting 'copy-img'...
[15:29:09] Finished 'copy-img' after 584 μs
[15:29:09] Starting 'copy-fonts'...
[15:29:09] Finished 'copy-fonts' after 597 μs
[15:29:09] Starting 'copy-api'...
[15:29:09] Finished 'copy-api' after 630 μs
[15:29:09] Starting 'read-templates'...
[15:29:09] Finished 'read-templates' after 1.87 ms
All templates written successfully!
[15:29:32] Version: webpack 1.15.0
Asset Size Chunks Chunk Names
app.js 1.19 MB 0 [emitted] app
app.map 9.63 MB 0 [emitted] app
ERROR in C:/Atlas_Repo/bin/custom/rodanandfields/rodanandfieldsstorefront/FE-Develop/web/webroot/WEB-INF/r2/fe-components/checkout/order-summary/order-summary.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../../../../../_ui/frontend/js/analytics/analytics-eventmap-r2 in C:\Atlas_Repo\bin\custom\rodanandfields\rodanandfieldsstorefront\FE-Develop\web/webroot/WEB-INF/r2/fe-components\checkout\order-summary
# C:/Atlas_Repo/bin/custom/rodanandfields/rodanandfieldsstorefront/FE-Develop/web/webroot/WEB-INF/r2/fe-components/checkout/order-summary/order-summary.js 23:30-103
ERROR in C:/Atlas_Repo/bin/custom/rodanandfields/rodanandfieldsstorefront/FE-Develop/web/webroot/WEB-INF/r2/fe-components/checkout/checkout-form-billing/checkout-form-billing.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../../../../../_ui/frontend/js/analytics/analytics-config-r2 in C:\Atlas_Repo\bin\custom\rodanandfields\rodanandfieldsstorefront\FE-Develop\web/webroot/WEB-INF/r2/fe-components\checkout\checkout-form-billing
# C:/Atlas_Repo/bin/custom/rodanandfields/rodanandfieldsstorefront/FE-Develop/web/webroot/WEB-INF/r2/fe-components/checkout/checkout-form-billing/checkout-form-billing.js 23:22-93
Which Hybris version are you using? I had a smilar problem with hybris 6.6. It worked for me after I switch to node v6.14.3 I was using a more recent node with a more recent npm version.
I found this version inside the npmancillary extension's folder
ext-content/npmancillary/resources/npm/node
After I upgrade my Nodejs to v9.3.0 and NPM to 5.5.1, failed to access the gulp serve server. The browser show the unsafe TLS security error.
I have removed ~.gcb-serve-data/, and run the gulp trust-dev-cert without error, but I cannot find the cert in my trust certificates, I am working in Win10.
Following is the **gulp trust-dev-cert" output:
[18:30:14] Starting gulp
[18:30:14] Starting 'trust-dev-cert'...
[18:30:14] Starting subtask 'configure-sp-build-rig'...
[18:30:14] Finished subtask 'configure-sp-build-rig' after 7.48 ms
[18:30:14] Starting subtask 'trust-cert'...
[18:30:14] Finished subtask 'trust-cert' after 79 ms
[18:30:14] Finished 'trust-dev-cert' after 90 ms
[18:30:14] ==================[ Finished ]==================
gulp trust-dev-cert must be executed IN the project folder.
Currently, I am trying to install MEAN on my windows 10 through cli (cmd).
I think i have completed all the installation part of MEAN and used npm to install all the packages as they were mentioned in tutorial and when I enter gulp (to run) it gives me this error :-
C:\...\nishant>gulp
Invoking gulp - development
[15:46:19] Using gulpfile ~\node\nishant\gulpfile.js
[15:46:19] Starting 'clean'...
[15:46:19] Finished 'clean' after 8.28 ms
[15:46:19] Starting 'default'...
[15:46:19] Starting 'webpack:build-dev'...
[15:46:19] Starting 'clean'...
[15:46:19] Starting 'less'...
[15:46:19] Starting 'sass'...
[15:46:19] Starting 'csslint'...
[15:46:19] Starting 'env:development'...
[15:46:19] Finished 'env:development' after 43 μs
[15:46:19] Starting 'devServe'...
[15:46:19] Finished 'devServe' after 96 ms
[15:46:19] Starting 'watch'...
[15:46:20] Finished 'watch' after 171 ms
[15:46:20] Finished 'clean' after 687 ms
[15:46:20] Finished 'less' after 692 ms
[15:46:20] Finished 'sass' after 418 ms
[15:46:20] csslint: 0 files lint free
[15:46:20] Finished 'csslint' after 399 ms
[15:46:20] [nodemon] 1.9.2
[15:46:20] [nodemon] to restart at any time, enter `rs`
[15:46:20] [nodemon] watching: *.*
[15:46:20] [nodemon] starting `node --debug server.js`
Debugger listening on port 5858
Error: connect ECONNREFUSED 127.0.0.1:27017
**Could not connect to MongoDB. Please ensure mongod is running and restart MEAN app.**
[15:46:27] [nodemon] clean exit - waiting for changes before restart
I tried to search for the answer but they were available for linux or mac but not for windows.
Looks like MongoDb is not running as a service. If memory serves, you may have to install the service manually. First check if it was installed: Start -> Run -> enter services.msc and look for it in the services list. If it's there, make sure it's running. If not, check out https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/ for steps on service installation.