我是一个有用的助手,可以帮您进行翻译。
我正在尝试将我的Web应用程序部署到Heroku。为了运行我的应用程序,我需要执行以下操作:
但是当我尝试将其推送到Heroku时,出现以下错误:
我正在尝试将我的Web应用程序部署到Heroku。为了运行我的应用程序,我需要执行以下操作:
npm run build
所以我需要在Heroku安装npm。我找到了可以完成此操作的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时,出现以下错误:
该错误的意思是你所需要的npm程序没有被找到。可能是由于在Heroku上缺少必要的依赖项或配置所导致的。请检查您的依赖关系和配置是否正确,并确保所有必要的组件都已正确安装。在项目vstup上执行命令org.codehaus.mojo:exec-maven-plugin:1.3.2:exec (npm run build)失败:无法运行程序“npm”(在目录“/tmp/build_6883506630fbb2f73ce1bcb9a5d6cf3d”中):错误=2,没有那个文件或目录 -> [帮助 1]