2017-10-04 84 views
0

在我的pom.xml中,这是我的前端maven-plugin配置的外观。 我的package.json和gulpfiles位于项目根目录中。Maven在目标目录中安装节点模块

<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.6</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> 

        <execution> 
         <id>npm install</id> 
         <goals> 
          <goal>npm</goal> 
         </goals> 

         <!-- optional: default phase is "generate-resources" --> 
         <phase>generate-resources</phase> 

         <configuration> 
          <!-- optional: The default argument is actually "install", so unless 
           you need to run some other npm command, you can remove this whole <configuration> 
           section. --> 
          <arguments>install ./target/node_modules</arguments> 

         </configuration> 
        </execution> 

        <execution> 
         <id>gulp</id> 
         <goals> 
          <goal>gulp</goal> 
         </goals> 
         <configuration> 
          <arguments>replace-runner-start</arguments> 
         </configuration> 
        </execution> 

        <execution> 
         <id>javascript tests</id> 
         <goals> 
          <goal>karma</goal> 
         </goals> 

         <!-- optional: the default plase is "test". Some developers choose 
          to run karma in the "integration-test" phase. --> 
         <phase>test</phase> 

         <configuration> 
          <!-- optional: the default is "karma.conf.js" in your working directory --> 
          <karmaConfPath>src/main/karma_webapp_all_conf.js</karmaConfPath> 
         </configuration> 
        </execution> 
       </executions> 
       <configuration> 
        <!-- <workingDirectory>src/main</workingDirectory> --> 
        <installDirectory>target</installDirectory> 
        <nodeVersion>v6.11.3</nodeVersion> 
       </configuration> 
      </plugin> 

当我运行mvn干净安装像这样我得到节点安装在目标中,但无法安装node_modules,因为该文件夹不存在。有没有另一种插件来制作目录并在那里安装node_modules。

回答

0

看起来像node_modules路径给出错误。检查你的node_modules的路径。这可以通过

全局库

做可以运行NPM list -g,看看那里安装全局库。

在Unix系统中,全局安装时,它们通常放置在/usr/local/lib/node/usr/local/lib/node_modules之间。如果将NODE_PATH环境变量设置为此路径,则可以按节点查找模块。

的Windows XP - %USERPROFILE%\Application Data\npm\node_modules 的Windows 7,第8和10 - %AppData%\npm\node_modules

非全局库

非全局库安装了node_modules子文件夹中的文件夹中,你目前在

您可以run npm list查看您当前位置安装的非全局库。