I generated a vanilla JHipster microservice gateway. With JHipster registry running I am able to start it using ./mvnw and it works. I can package it using ./mvnw -Pdev package and that works. However, if I try to package it using ./mvnw -Pprod package it fails apparently during the webpack build prod step.
yo-rc.json
{
"generator-jhipster": {
"promptValues": {
"packageName": "org.jhipster.blog",
"nativeLanguage": "en"
},
"jhipsterVersion": "4.14.0",
"baseName": "blog",
"packageName": "org.jhipster.blog",
"packageFolder": "org/jhipster/blog",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "hazelcast",
"enableHibernateCache": true,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "postgresql",
"searchEngine": "elasticsearch",
"messageBroker": false,
"serviceDiscoveryType": "eureka",
"buildTool": "maven",
"enableSocialSignIn": false,
"enableSwaggerCodegen": false,
"jwtSecretKey": "0b9d434149a3efef6af7362acaf33585d5eaa492",
"clientFramework": "angularX",
"useSass": false,
"clientPackageManager": "yarn",
"applicationType": "gateway",
"testFrameworks": [
"gatling",
"protractor"
],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "en",
"languages": [
"en",
"es"
]
}
}
Maven Output
[INFO] --- frontend-maven-plugin:1.6:yarn (webpack build prod) @ blog ---
[INFO] yarn not inheriting proxy config from Maven
[INFO] Running 'yarn run webpack:prod' in /Users/mschreiber/temp/microservice-demo/blog
[INFO] yarn run v1.3.2
[INFO] $ yarn run cleanup && yarn run webpack:prod:main && yarn run clean-www
[INFO] $ rimraf target/{aot,www}
[INFO] $ yarn run webpack -- --config webpack/webpack.prod.js --profile
[ERROR] warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts.
[INFO] $ node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --config webpack/webpack.prod.js --profile
[INFO] MergetJsonsWebpackPlugin compilation started...
[INFO] MergetJsonsWebpackPlugin compilation completed...
[ERROR] buffer.js:202
[ERROR] throw new TypeError(kFromErrorMsg);
[ERROR] ^
[ERROR]
[ERROR] TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
[ERROR] at Function.Buffer.from (buffer.js:202:9)
[ERROR] at new Buffer (buffer.js:158:17)
[ERROR] at writeOut (/Users/mschreiber/temp/microservice-demo/blog/node_modules/webpack/lib/Compiler.js:334:17)
[ERROR] at require.forEach (/Users/mschreiber/temp/microservice-demo/blog/node_modules/webpack/lib/Compiler.js:345:12)
[ERROR] at /Users/mschreiber/temp/microservice-demo/blog/node_modules/webpack/node_modules/async/dist/async.js:3096:16
[ERROR] at eachOfArrayLike (/Users/mschreiber/temp/microservice-demo/blog/node_modules/webpack/node_modules/async/dist/async.js:1055:9)
[ERROR] at eachOf (/Users/mschreiber/temp/microservice-demo/blog/node_modules/webpack/node_modules/async/dist/async.js:1103:5)
[ERROR] at Object.eachLimit (/Users/mschreiber/temp/microservice-demo/blog/node_modules/webpack/node_modules/async/dist/async.js:3158:5)
[ERROR] at emitFiles (/Users/mschreiber/temp/microservice-demo/blog/node_modules/webpack/lib/Compiler.js:315:21)
[ERROR] at /Users/mschreiber/temp/microservice-demo/blog/node_modules/mkdirp/index.js:30:20
[ERROR] at FSReqWrap.oncomplete (fs.js:135:15)
[ERROR] error Command failed with exit code 1.
[INFO] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[ERROR] error Command failed with exit code 1.
[INFO] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[ERROR] error Command failed with exit code 1.
[INFO] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:05 min
[INFO] Finished at: 2018-03-06T08:32:03-05:00
[INFO] Final Memory: 44M/372M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.6:yarn (webpack build prod) on project blog: Failed to run task: 'yarn run webpack:prod' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
This issue is related to the workbox-webpack-plugin dependency of JHipster and is fixed in the v4.14.1 release (related commit). To fix it in your generated project, make the following changes:
package.json:
- "workbox-webpack-plugin": "3.0.0-alpha.3",
+ "workbox-webpack-plugin": "3.0.0-beta.1",
webpack/webpack.prod.js
- new WorkboxPlugin({
+ new WorkboxPlugin.GenerateSW({
You can also upgrade to the latest generator-jhipster release with yarn global upgrade generator-jhipster, then upgrade your project with jhipster upgrade. For more info on the upgrade command, see the relevant documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With