Jhipster应用程序失败并显示错误:启用了prod配置文件的mvn package命令上的JavaScript堆内存不足

时间:2017-08-04 10:20:02

标签: maven jhipster

我已经运行了命令。如Jhipster文档中所述。

  

要将应用程序打包为“生产”WAR,请键入:

     

./ mvnw -Pprod package

我在dev mod中运行我的应用程序没有问题。根据日志,我可以运行命令,mvnw失败,没有错误。

  

纱线运行webpack:prod

这个命令第一次运行完美,没有任何错误。但在命令完成后,我无法再构建项目

  

纱线运行webpack:build

返回错误:

Found bindings for the following environments:
  - Windows 32-bit with Node.js 6.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.
    at module.exports (D:\Projects\devizion_mock\node_modules\node-sass\lib\binding.js:15:13)
    at Object.<anonymous> (D:\Projects\devizion_mock\node_modules\node-sass\lib\index.js:14:35)

我不知道这是否是预期的行为。但解决此问题的唯一方法是完全删除node_modules文件夹并重新安装依赖项。只有这样我才能再次成功建立项目。

这次我真的不知道在哪里看,甚至谷歌要问什么。我会很高兴任何clues0

我认为,这是失败的maven插件:

                             <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>com.github.eirslett</groupId>
                                    <artifactId>frontend-maven-plugin</artifactId>
                                    <versionRange>${frontend-maven-plugin.version}</versionRange>
                                    <goals>
                                        <goal>install-node-and-yarn</goal>
                                        <goal>yarn</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore/>
                                </action>
                            </pluginExecution>

mvnw包的堆栈跟踪-Prod命令错误

[INFO] $ node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js --config webpack/webpack.prod.js --progress --profile
[ERROR] FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
[ERROR] error Command failed with exit code 3.
[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: 03:48 min
[INFO] Finished at: 2017-08-03T15:38:24+03:00
[INFO] Final Memory: 21M/51M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:yarn (webpack build prod) on project devizion: Failed to run task: 'yarn run webpack:prod' failed. org.ap
ache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:yarn (webpack build prod) on project devizion: Failed to
run task
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:39)
        at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:122)
        at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:50)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to run task
        at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute(AbstractFrontendMojo.java:121)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 27 more
Caused by: com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException: 'yarn run webpack:prod' failed.
        at com.github.eirslett.maven.plugins.frontend.lib.YarnTaskExecutor.execute(YarnTaskExecutor.java:64)
        at com.github.eirslett.maven.plugins.frontend.mojo.YarnMojo.execute(YarnMojo.java:65)
        at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute(AbstractFrontendMojo.java:115)
        ... 29 more
Caused by: com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutionException: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
        at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.execute(ProcessExecutor.java:82)
        at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.executeAndRedirectOutput(ProcessExecutor.java:64)
        at com.github.eirslett.maven.plugins.frontend.lib.YarnExecutor.executeAndRedirectOutput(YarnExecutor.java:28)
        at com.github.eirslett.maven.plugins.frontend.lib.YarnTaskExecutor.execute(YarnTaskExecutor.java:58)
        ... 31 more
Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
        at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
        at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.execute(ProcessExecutor.java:74)
        ... 34 more
[ERROR]
[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

修改

纱线运行webpack后出现的错误:prod可以通过npm rebuild node-sass --force来解决。我之前试过这个但是没用。我不得不更新我的python和.NET SDK才能工作。它仍然会发出一些错误,但是在此命令之后项目仍然成功构建。

1 个答案:

答案 0 :(得分:1)

我更改了&#34; max_old_space_size = 4096 &#34;对于webpack-dev-server和webpack行在 package.json 中的较低值(在本例中为2000),问题就消失了。