2017-08-04 1 views
0

J'ai exécuté la commande. Comme décrit dans les documents Jhipster.L'application Jhipster échoue avec l'erreur: le tas JavaScript manque de mémoire sur la commande de package mvn avec le profil prod activé

To package the application as a “production” WAR, type:

./mvnw -Pprod package

Je n'ai aucun problème pour lancer mon application en mod mod. La chose bizarre est que je peux exécuter la commande, à laquelle mvnw échoue, selon le journal, sans erreurs.

yarn run webpack:prod

Cette commande s'exécute parfaitement sans erreur pour la première fois. Mais après la commande complète je ne peux plus construire le projet

yarn run webpack:build

Renvoie une erreur:

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) 

Je Ne sais pas si cela est un comportement attendu. Mais la seule chose qui résout cela est de supprimer complètement le dossier node_modules et de réinstaller les dépendances. Seulement alors je peux reconstruire le projet avec succès.

Cette fois je n'ai vraiment aucune idée où chercher ou même quoi demander de google. Je serais reconnaissant pour toute clues0

Ceci est, je crois, le plugin maven qui échoue:

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

La trace de pile d'erreur de commande package mvnw de -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 

Modifier

L'erreur qui apparaît après l'exécution de fil webpack: prod peut être résolue avec npm rebuild node-sass -force. J'ai déjà essayé ça mais ça n'a pas marché. J'ai dû mettre à jour mon Python et .NET SDK pour que cela fonctionne. Il émet toujours une erreur mais néanmoins les projets se construisent avec succès après cette commande.

+0

Comme vous êtes le premier à signaler un tel problème et qu'il semble que votre projet utilise node-sass, avez-vous essayé de commenter le plugin sass dans webpack config? Avez-vous essayé d'augmenter la mémoire des nœuds en utilisant '--max-old-space-size' dans les scripts package.json? –

Répondre

0

j'ai changé "max_old_space_size = 4096" pour webpack-dev-serveur et les lignes webpack à une valeur inférieure (2000 dans ce cas) dans package.json et la question a disparu.