无法在项目npm上执行目标org.codehaus.mojo:exec-maven-plugin:1.3.2:exec(npm运行构建)

时间:2019-07-17 18:44:53

标签: node.js maven npm

我正在尝试将我的Web应用程序部署到heroku。要运行我的应用程序,我需要执行

   npm run build

所以我需要将npm安装到Heroku。我找到了做它的Maven插件,还有一个执行脚本的插件。

   <build>
    <plugins>
        <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <!-- Use the latest released version:
            https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
            <version>1.7.5</version>
            <executions>
                <execution>
                <!-- optional: you don't really need execution ids, but it looks nice in your build log. -->
                <id>install node and npm</id>
                <goals>
                    <goal>install-node-and-npm</goal>
                </goals>
                <!-- optional: default phase is "generate-resources" -->
                <phase>generate-resources</phase>
            </execution>

            </executions>
            <configuration>
                <nodeVersion>v11.15.0</nodeVersion>
                <npmDownloadRoot>https://nodejs.org/dist/v6.11.3/win-x64/node.exe</npmDownloadRoot>

            </configuration>

        </plugin>                     
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.3.2</version>
            <executions>
                <execution>
                    <id>npm run build</id>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <phase>compile</phase>
                    <configuration>
                        <executable>npm</executable>
                        <arguments>
                            <argument>run</argument>
                            <argument>build</argument>
                        </arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

但是当我尝试将其推送到heroku时,我得到了:

  

无法在项目vstup上执行目标org.codehaus.mojo:exec-maven-plugin:1.3.2:exec(npm run build):命令执行失败。无法运行程序“ npm”(在目录“ / tmp / build_6883506630fbb2f73ce1bcb9a5d6cf3d”中):错误= 2,无此类文件或目录-> [帮助1]

0 个答案:

没有答案