maven-frontend-plugin构建错误

时间:2016-05-29 18:46:29

标签: maven npm angular

我一直致力于在eclipse中获得角度2设置。设置maven时遇到错误。我对maven相对较新,我不确定如何克服错误。任何帮助将不胜感激。

[INFO] --- frontend-maven-plugin:1.0:npm (npm install) @ BudgetCalculator ---
[INFO] Running 'npm install' in /Users/csexton/Eclipse-Workspace/REST/BudgetCalculator
[INFO] budget_calculator@1.0.0 /Users/csexton/Eclipse-Workspace/REST/BudgetCalculator
[INFO] +-- angular2@2.0.0-beta.17 
[INFO] +-- UNMET PEER DEPENDENCY es6-shim@^0.35.0
[INFO] +-- UNMET PEER DEPENDENCY reflect-metadata@0.1.2
[INFO] +-- UNMET PEER DEPENDENCY rxjs@5.0.0-beta.6
[INFO] `-- UNMET PEER DEPENDENCY zone.js@^0.6.12
[INFO] 
[WARNING] npm WARN EPEERINVALID angular2@2.0.0-beta.17 requires a peer of es6-shim@^0.35.0 but none was installed.
[WARNING] npm WARN EPEERINVALID angular2@2.0.0-beta.17 requires a peer of reflect-metadata@0.1.2 but none was installed.
[WARNING] npm WARN EPEERINVALID angular2@2.0.0-beta.17 requires a peer of rxjs@5.0.0-beta.6 but none was installed.
[WARNING] npm WARN EPEERINVALID angular2@2.0.0-beta.17 requires a peer of zone.js@^0.6.12 but none was installed.
[WARNING] npm WARN EPACKAGEJSON budget_calculator@1.0.0 No description
[WARNING] npm WARN EPACKAGEJSON budget_calculator@1.0.0 No repository field.
[WARNING] npm WARN EPACKAGEJSON budget_calculator@1.0.0 No license field.
[INFO] 
[INFO] --- frontend-maven-plugin:1.0:npm (npm run build) @ BudgetCalculator ---
[INFO] Running 'npm run build' in /Users/csexton/Eclipse-Workspace/REST/BudgetCalculator
[ERROR] npm ERR! Darwin 15.4.0
[ERROR] npm ERR! argv "/Users/csexton/Eclipse-Workspace/REST/BudgetCalculator/node/node" "/Users/csexton/Eclipse-Workspace/REST/BudgetCalculator/node/node_modules/npm/bin/npm-cli.js" "run" "build"
[ERROR] npm ERR! node v5.3.0
[ERROR] npm ERR! npm  v3.3.12
[ERROR] 
[ERROR] npm ERR! missing script: build
[ERROR] npm ERR! 
[ERROR] npm ERR! If you need help, you may report this error at:
[ERROR] npm ERR!     <https://github.com/npm/npm/issues>
[ERROR] 
[ERROR] npm ERR! Please include the following file with any support request:
[ERROR] npm ERR!     /Users/csexton/Eclipse-Workspace/REST/BudgetCalculator/npm-debug.log
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.356 s
[INFO] Finished at: 2016-05-29T14:36:25-04:00
[INFO] Final Memory: 13M/309M
[INFO] ------------------------------------------------------------------------

我可以看到的两件事可能是问题,但我不知道如何解决或导致错误的原因:npm ERR! missing script: build&amp;

[INFO] +-- UNMET PEER DEPENDENCY es6-shim@^0.35.0
[INFO] +-- UNMET PEER DEPENDENCY reflect-metadata@0.1.2
[INFO] +-- UNMET PEER DEPENDENCY rxjs@5.0.0-beta.6
[INFO] `-- UNMET PEER DEPENDENCY zone.js@^0.6.12

package.json文件

{
  "name": "budget_calculator",
  "version": "1.0.0",
  "dependencies": {
    "angular2": "2.0.0-beta.17",
    "es6-shim":"^0.35.0",
    "reflect-metadata":"0.1.2",
    "rxjs":"5.0.0-beta.6",
    "zone.js":"^0.6.12"
  }
}

我用来安装插件的pom.xml部分

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <version>1.0</version>

            <executions>

                <execution>
                    <id>install node and npm</id>
                    <goals>
                        <goal>install-node-and-npm</goal>
                    </goals>
                    <configuration>
                        <nodeVersion>v5.3.0</nodeVersion>
                        <npmVersion>3.3.12</npmVersion>
                    </configuration>
                </execution>

                <execution>
                    <id>npm install</id>
                    <goals>
                        <goal>npm</goal>
                    </goals>
                    <!-- Optional configuration which provides for running any npm command -->
                    <configuration>
                        <arguments>install</arguments>
                    </configuration>
                </execution>

                <execution>
                    <id>npm run build</id>
                    <goals>
                        <goal>npm</goal>
                    </goals>
                    <configuration>
                        <arguments>run build</arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

1 个答案:

答案 0 :(得分:1)

您似乎在package.json

中缺少这些依赖项
"dependencies": {
    ...
    "es6-shim":"^0.35.0",
    "reflect-metadata":"0.1.2",
    "rxjs":"5.0.0-beta.6",
    "zone.js":"^0.6.12"
}

您还缺少一个名为build的脚本,您可以在package.json中添加该脚本,因为在您pom.xml中,您有<id>npm run build</id>

{
  ...
  "scripts": {
    "build": "..."
  },
  "dependencies": {
  ...
  }
}