eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.26k stars 870 forks source link

Failed to run (com.github.eirslett:frontend-maven-plugin:1.2:webpack:webpack build:generate-resources) #689

Open DragonWarriorPoo opened 6 years ago

DragonWarriorPoo commented 6 years ago

`<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

4.0.0 ReactApp ReactWithSpringBootApp war 0.0.1-SNAPSHOT ReactWithSpringBootApp Maven Webapp http://maven.apache.org org.springframework.boot spring-boot-starter-parent 1.5.1.RELEASE
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.7</java.version>
</properties>
org.springframework.boot spring-boot-starter-thymeleaf org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-data-rest org.springframework.boot spring-boot-devtools org.projectlombok lombok com.h2database h2 runtime org.springframework.boot spring-boot-starter-test test junit junit 3.8.1 test ReactWithSpringBootApp org.springframework.boot spring-boot-maven-plugin com.github.eirslett frontend-maven-plugin 1.2 target install node and npm install-node-and-npm v4.4.5 3.9.2 npm install npm install webpack build webpack

`

This is my pom.xml npm install works properly but it gives a error at :
`

webpack build
                    <goals>
                        <goal>webpack</goal>
                    </goals>
                </execution>`

It shows following error in pom.xml: Failed to run task (com.github.eirslett:frontend-maven-plugin:1.2:webpack:webpack build:generate-resources) org.apache.maven.plugin.MojoFailureException: Failed to run task at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute(AbstractFrontendMojo.java:95) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331) at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362) at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360) at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52) at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137) at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172) at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1) at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99) at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86) at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:142) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:232) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56) Caused by: com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException: 'webpack.js ' failed. at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:63) at com.github.eirslett.maven.plugins.frontend.mojo.WebpackMojo.execute(WebpackMojo.java:64) at com.github.eirslett.maven.plugins.frontend.mojo.AbstractFrontendMojo.execute(AbstractFrontendMojo.java:89) ... 32 more Caused by: com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutionException: java.io.IOException: Cannot run program "C: \sumaya\workspace\STS\ReactWithSpringBootApp\target\node\node.exe" (in directory "C: \sumaya\workspace\STS\ReactWithSpringBootApp"): CreateProcess error=2, The system cannot find the file specified at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.executeAndRedirectOutput(ProcessExecutor.java:73) at com.github.eirslett.maven.plugins.frontend.lib.NodeExecutor.executeAndRedirectOutput(NodeExecutor.java:29) at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:58) ... 34 more Caused by: java.io.IOException: Cannot run program "C:\sumaya\workspace\STS\ReactWithSpringBootApp\target\node\node.exe" (in directory "C: \sumaya\workspace\STS\ReactWithSpringBootApp"): CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(Unknown Source) at com.github.eirslett.maven.plugins.frontend.lib.ProcessExecutor.executeAndRedirectOutput(ProcessExecutor.java:61) ... 36 more Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) ... 38 more

nrosenw commented 5 years ago

I'm having a very similar error in my project with Eclipse but instead with version 1.6. Here's my output from maven...

PS C:\Users\Nathan\Workspaces\vehicle-data-spring-demo\vehicle-data-spring-demo> .\mvnw clean install package
Found "C:\Users\Nathan\Workspaces\vehicle-data-spring-demo\vehicle-data-spring-demo\.mvn\wrapper\maven-wrapper.jar"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Spring Demo 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ springDemo ---
[INFO] Deleting C:\Users\Nathan\Workspaces\vehicle-data-spring-demo\vehicle-data-spring-demo\target
[INFO]
[INFO] --- frontend-maven-plugin:1.6:install-node-and-npm (install node and npm) @ springDemo ---
[INFO] Installing node version v10.11.0
[INFO] Copying node binary from C:\Users\Nathan\.m2\repository\com\github\eirslett\node\10.11.0\node-10.11.0-win-x64.exe to C:\Users\Nathan\Workspaces\vehicle-data-spring-demo\vehicle-data-spring-demo\target\node\node.exe
[INFO] Installed node locally.
[INFO] Installing npm version 6.4.1
[INFO] Unpacking C:\Users\Nathan\.m2\repository\com\github\eirslett\npm\6.4.1\npm-6.4.1.tar.gz into C:\Users\Nathan\Workspaces\vehicle-data-spring-demo\vehicle-data-spring-demo\target\node\node_modules
[INFO] Installed npm locally.
[INFO]
[INFO] --- frontend-maven-plugin:1.6:npm (npm install) @ springDemo ---
[INFO] Running 'npm install' in C:\Users\Nathan\Workspaces\vehicle-data-spring-demo\vehicle-data-spring-demo
[WARNING] npm WARN Invalid version: "1.1"
[WARNING] npm WARN vehicle-data-spring-demo No description
[WARNING] npm WARN vehicle-data-spring-demo No repository field.
[WARNING] npm WARN vehicle-data-spring-demo No README data
[WARNING] npm WARN vehicle-data-spring-demo No license field.
[ERROR]
[INFO] up to date in 0.537s
[INFO] found 0 vulnerabilities
[INFO]
[INFO]
[INFO] --- frontend-maven-plugin:1.6:webpack (webpack build) @ springDemo ---
[INFO] Running 'webpack.js ' in C:\Users\Nathan\Workspaces\vehicle-data-spring-demo\vehicle-data-spring-demo
[ERROR] internal/modules/cjs/loader.js:583
[ERROR]     throw err;
[ERROR]     ^
[ERROR]
[ERROR] Error: Cannot find module 'C:\Users\Nathan\Workspaces\vehicle-data-spring-demo\vehicle-data-spring-demo\target\node_modules\webpack\bin\webpack.js'
[ERROR]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
[ERROR]     at Function.Module._load (internal/modules/cjs/loader.js:507:25)
[ERROR]     at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
[ERROR]     at startup (internal/bootstrap/node.js:279:19)
[ERROR]     at bootstrapNodeJSCore (internal/bootstrap/node.js:752:3)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 47.088 s
[INFO] Finished at: 2019-02-07T16:25:47-05:00
[INFO] Final Memory: 25M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.6:webpack (webpack build) on project springDemo: Failed to run task: 'webpack.js ' 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

POM.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>io.rosenwald</groupId>
    <artifactId>springDemo</artifactId>
    <version>1.0</version>
    <packaging>war</packaging>

    <name>Spring Demo</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.0.RELEASE</version>
        <relativePath/>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <spring-boot-admin.version>2.1.0-SNAPSHOT</spring-boot-admin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion> <!-- Required as WildFly is now our container rather than the Tomcat Embedded. -->
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope> <!-- Required as WildFly is now our container rather than the Tomcat Embedded. -->
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
            <version>1.6</version>
        </dependency>
        <dependency>
        <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>4.2</version>
        </dependency>
        <dependency>
            <groupId>org.mariadb.jdbc</groupId>
            <artifactId>mariadb-java-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>de.codecentric</groupId>
                <artifactId>spring-boot-admin-dependencies</artifactId>
                <version>${spring-boot-admin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.6</version>
                <configuration>
                    <installDirectory>target</installDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>v10.11.0</nodeVersion>
                            <npmVersion>6.4.1</npmVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>install</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>webpack build</id>
                        <goals>
                            <goal>webpack</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <delimiters>
                        <delimiter>@</delimiter>
                    </delimiters>
                    <useDefaultDelimiters>false</useDefaultDelimiters>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>sonatype-snapshots</id>
            <name>Sonatype Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

</project>
nrosenw commented 5 years ago

@DragonWarriorPoo, check your package.json and ensure that when you run a Maven build from the command line that you don't see similar warnings to these:

[WARNING] npm WARN Invalid version: "1.1"
[WARNING] npm WARN vehicle-data-spring-demo No description
[WARNING] npm WARN vehicle-data-spring-demo No repository field.
[WARNING] npm WARN vehicle-data-spring-demo No README data
[WARNING] npm WARN vehicle-data-spring-demo No license field.

I was not using semantic versioning, so once I changed the version in my package.json I started making progress on my build. These are 'warnings' and not 'errors' so I was assuming that this wasn't my cause of error but I stand corrected. I would also recommend updating to version 1.6.