2017-06-14 229 views
1

当我安装NPM安装--save @角/材料角2+,材料不工作

它给了我下面的响应:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]^1.0.0 (node_modules\chokidar\node_modules\fsevents): 
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) 

但是这上面一个仅仅是警告,但当我尝试在app.module.ts实际导入NPM启动休息如下:

npm ERR! Windows_NT 10.0.14393 
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "build" 
npm ERR! node v6.10.0 
npm ERR! npm v3.10.10 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] build: tsc -p src/ 
npm ERR! Exit status 2 
npm ERR! 
npm ERR! Failed at the [email protected] build script 'tsc -p src/'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the angular-quickstart package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR! tsc -p src/ 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR! npm bugs angular-quickstart 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR! npm owner ls angular-quickstart 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR! E:\My Projects\angular-quickstart-master\npm-debug.log 

npm ERR! Windows_NT 10.0.14393 
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start" 
npm ERR! node v6.10.0 
npm ERR! npm v3.10.10 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] prestart: npm run build 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] prestart script 'npm run build'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the angular-quickstart package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR! npm run build 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR! npm bugs angular-quickstart 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR! npm owner ls angular-quickstart 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR! E:\My Projects\angular-quickstart-master\npm-debug.log 

我不是确定什么是确切的问题。任何人都可以帮忙。

+0

您是否尝试过删除node_modules文件夹,运行 “故宫安装” 命令?哪个版本的npm在你的机器上? –

+0

其3.10.10和节点版本是6.10.0 – Jinesh

+0

我将全局升级我的节点和npm,然后删除我的项目中的node_modules文件夹,然后重新安装所有依赖项。几周前我有类似的问题,并通过这种方法得到解决。目前,我在节点上:v6.10.3和npm:5.0.3 –

回答

0

我已经使用您提供的package.json创建了一个新的角度项目,并且一切都很好。我觉得升级node/npm是一种方式。

"dependencies": { "@angular/common": "~4.0.0", "@angular/compiler": "~4.0.0", "@angular/core": "~4.0.0", "@angular/forms": "~4.0.0", "@angular/http": "~4.0.0", "@angular/material": "^2.0.0-beta.6", "@angular/platform-browser": "~4.0.0", "@angular/platform-browser-dynamic": "~4.0.0", "@angular/router": "~4.0.0", "angular-in-memory-web-api": "~0.3.0", "core-js": "^2.4.1", "rxjs": "5.0.1", "systemjs": "0.19.40", "zone.js": "^0.8.4" }, "devDependencies": { "concurrently": "^3.2.0", "lite-server": "^2.2.2", "typescript": "~2.1.0", "canonical-path": "0.0.2", "tslint": "^3.15.1", "lodash": "^4.16.4", "jasmine-core": "~2.4.1", "karma": "^1.3.0", "karma-chrome-launcher": "^2.0.0", "karma-cli": "^1.0.1", "karma-jasmine": "^1.0.2", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~4.0.14", "rimraf": "^2.5.4", "@types/node": "^6.0.46", "@types/jasmine": "2.5.36" }

enter image description here

+0

因此,您可以导入材料并将其用于您的应用程序中吗? – Jinesh