JHipster Prod Package期间Webpack失败 [英] Webpack failure during JHipster Prod Package

查看:70
本文介绍了JHipster Prod Package期间Webpack失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我生成了一个普通的JHipster微服务网关.在运行JHipster注册表的情况下,我可以使用./mvnw启动它,并且它可以工作.我可以使用./mvnw -Pdev package将其打包,并且可以正常工作.但是,如果我尝试使用./mvnw -Pprod package对其进行打包,则在webpack构建prod步骤期间,它显然会失败.

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.

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

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

[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

推荐答案

此问题与JHipster的workbox-webpack-plugin依赖关系相关,已在

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({

您还可以使用yarn global upgrade generator-jhipster升级到最新的generator-jhipster版本,然后使用jhipster upgrade升级项目.有关升级命令的更多信息,请参见相关文档.

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.

这篇关于JHipster Prod Package期间Webpack失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆