JHipster Prod Package期间Webpack失败

时间:2018-03-06 13:56:53

标签: jhipster

我生成了一个vanilla JHipster微服务网关。运行JHipster注册表后,我可以使用./mvnw启动它,它可以工作。我可以使用./mvnw -Pdev package打包它,这样可行。但是,如果我尝试使用./mvnw -Pprod package打包它,它在webpack build prod步骤中显然会失败。

  • JHipster版本4.14.0
  • 纱线版本​​1.3.2
  • 节点版本v6.11.5

溜溜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输出

[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

1 个答案:

答案 0 :(得分:6)

此问题与JHipster的obj[key][index][other_key]依赖关系有关,并已在v4.14.1 releaserelated commit)中修复。要在生成的项目中修复它,请进行以下更改:

workbox-webpack-plugin

您还可以使用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({ 升级到最新的generator-jhipster版本,然后使用yarn global upgrade generator-jhipster升级您的项目。有关升级命令的更多信息,请参阅relevant documentation