我使用angular-cli生成了我的angular 2项目。 由于项目和客户的限制,我无法升级到角度4。angular-cli + mvn:无法启动构建
我尝试使用frontend-maven-plugin来编译我的角度应用与maven,但是当我启动mvn干净安装时,构建脚本失败。
我得到了错误:
[ERROR] ..pathToProject/node_modules/@ngtools/json-schema/src/schema-class-factory.js:34 [ERROR] result.push(...indices); [ERROR]
^^^ [ERROR] [ERROR] SyntaxError: Unexpected token ... [ERROR] at exports.runInThisContext (vm.js:53:16) [ERROR] at Module._compile (module.js:373:25) [ERROR] at Object.Module._extensions..js (module.js:416:10) [ERROR] at Module.load (module.js:343:32) [ERROR] at Function.Module._load (module.js:300:12) [ERROR] at Module.require (module.js:353:17) [ERROR] at require (internal/module.js:12:17) [ERROR] at Object. (..pathToProject/node_modules/@ngtools/json-schema/src/index.js:3:30) [ERROR] at Module._compile (module.js:409:26) [ERROR] at Object.Module._extensions..js (module.js:416:10) [ERROR] [ERROR] npm ERR! Linux 4.4.0-92-generic [ERROR] npm ERR! argv "..pathToProject/node/node" "..pathToProject/node/node_modules/npm/bin/npm-cli.js" "run-script" "build" [ERROR] npm ERR! node v4.6.0 [ERROR] npm ERR! npm v2.15.9 [ERROR] npm ERR! code ELIFECYCLE [ERROR] npm ERR! [email protected] build:ng build
[ERROR] npm ERR! Exit status 1 [ERROR] npm ERR! [ERROR] npm ERR! Failed at the [email protected] build script 'ng build'. [ERROR] npm ERR! This is most likely a problem with the hsmt package, [ERROR] npm ERR! not with npm itself. [ERROR] npm ERR! Tell the author that this fails on your system: [ERROR] npm ERR! ng build [ERROR] npm ERR! You can get information on how to open an issue for this project with: [ERROR] npm ERR! npm bugs hsmt
我POM:
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v4.6.0</nodeVersion>
<npmVersion>v2.15.9</npmVersion>
</configuration>
</execution>
<execution>
<id>build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run-script build</arguments>
</configuration>
<phase>generate-resources</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
我的package.json:
{
"name": "hsmt",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build",
"prod" : "ng build --prod",
"test": "ng test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor",
"prebuild": "npm install"
},
' V4 .6.0 nodeVersion>':-o。目前的价格是6.11.2。检查您在maven之外使用的版本,并将其粘贴到您的pom.xml中。顺便说一句这个错误只出现在maven中? (我想是的) –
n00dl3
伟大的这是与节点v6.11.2 :)(这确实是我的电脑上安装的版本)我试图升级npm,但似乎它无法找到v3.10.10在https:/ /registry.npmjs.org/npm/你知道我应该使用哪个回购吗? – Lempkin
我在我的maven项目中使用npm'3.8.6'节点为'6.11.0'我猜你可以同时使用节点'6.11.2'和npm'3.8.6' ... – n00dl3