npm在angular2中安装错误

时间:2016-08-01 15:33:01

标签: angular npm

我是angular2的初学者 当我输入npm install时,我收到了这些错误:

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14
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 angular2@2.0.0-alpha.32,当我输入npm start时 我有这些错误消息:

> ng2-test@1.0.0 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! ng2-test@1.0.0 start: `concurrent "npm run tsc:w" "npm run lite" `
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ng2-test@1.0.0 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

1 个答案:

答案 0 :(得分:2)

您可以尝试以下步骤 -

  1. 从项目中删除node_modules文件夹。
  2. 运行&n; npm缓存清理'命令。
  3. 运行' npm install'命令。
  4. 我在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

    看看这是否有帮助。