2016-08-01 166 views
0

我在angular2 一个初学者当我键入npm install我得到这些错误:NPM安装错误angular2

npm WARN optional Skipping failed optional dependency /chokidar/fsevents: 
npm WARN notsup Not compatible with your operating system or architecture: [email protected] 
npm ERR! Windows_NT 10.0.10586 
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" 
npm ERR! node v6.3.0 
npm ERR! npm v3.10.3 
npm ERR! file C:\Users\SIDAHMED\AppData\Roaming\npm-cache\chalk\1.1.3\package\package.json 
npm ERR! code EJSONPARSE 

npm ERR! Failed to parse json 
npm ERR! Unexpected token '\u0000' at 1:1 
npm ERR! 
npm ERR!^
npm ERR! File: C:\Users\SIDAHMED\AppData\Roaming\npm-cache\chalk\1.1.3\package\package.json 
npm ERR! Failed to parse package.json data. 
npm ERR! package.json must be actual JSON, not just JavaScript. 
npm ERR! 
npm ERR! This is not a bug in npm. 
npm ERR! Tell the package author to fix their package.json file. JSON.parse 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Users\SIDAHMED\Documents\angular2\npm-debug.log 

的package.json文件:

{ 
    "name": "ng2-test", 
    "version": "1.0.0", 
    "scripts": { 
    "start": "concurrent \"npm run tsc:w\" \"npm run lite\" ",  
    "tsc": "tsc", 
    "tsc:w": "tsc -w", 
    "lite": "lite-server", 
    "typings": "typings", 
    "postinstall": "typings install" 
    }, 
    "license": "ISC", 
    "dependencies": { 
    "angular2": "2.0.0-beta.7", 
    "systemjs": "0.19.22", 
    "es6-promise": "^3.0.2", 
    "es6-shim": "^0.33.3", 
    "reflect-metadata": "0.1.2", 
    "rxjs": "5.0.0-beta.2", 
    "zone.js": "0.5.15" 
    }, 
    "devDependencies": { 
    "concurrently": "^2.0.0", 
    "lite-server": "^2.1.0", 
    "typescript": "^1.7.5", 
    "typings":"^0.6.8" 
    } 
} 

我想npm install [email protected]当我键入我有这些错误信息:

> [email protected] start C:\Users\SIDAHMED\Documents\angular2 
> concurrent "npm run tsc:w" "npm run lite" 

'concurrent' n’est pas reconnu en tant que commande interne 
ou externe, un programme exécutable ou un fichier de commandes. 

npm ERR! Windows_NT 10.0.10586 
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.3.0 
npm ERR! npm v3.10.3 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] start: `concurrent "npm run tsc:w" "npm run lite" ` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] start script 'concurrent "npm run tsc:w" "npm run lite" '. 
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 ng2-test package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  concurrent "npm run tsc:w" "npm run lite" 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs ng2-test 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls ng2-test 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Users\SIDAHMED\Documents\angular2\npm-debug.log 
+4

请提供您的package.json文件。 –

回答

2

您可以尝试以下步骤 -

  1. 从您的项目中删除node_modules文件夹。
  2. 运行'npm cache clean'命令。
  3. 运行'npm install'命令。

我已经验证了上http://jsonlint.com/您的package.json,并期待有效JSON-

package.json validattion

按的package.json您使用"angular2": "2.0.0-beta.7"这是很老版本的提供。当前版本的Angular2是2.0.0-rc.4。你可以在这里找到更多的信息 - https://angular.io/guide/quickstart

看看这是否有帮助。