在npm安装期间获取无法解析package.json数据

时间:2017-05-12 19:01:37

标签: json node.js angular npm

在Windows 10上的npm安装期间我收到此错误 我使用的是节点v6.10.3和npm v3.10.10

请帮助纠正此问题。

错误我正在

npm ERR! npm  v3.10.10
npm ERR! file C:\angular2-helloworld\package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token '\r' at 5:71
npm ERR!     "start": "tsc && concurrently \"npm run tsc:w\" \"npm run 
lite\"\
npm ERR!                                                                      
^
npm ERR! File: C:\angular2-helloworld\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.parsenpm ERR! node v6.10.3

package.json文件内容:

{  
   "name":"angular2-helloworld",
   "version":"1.0.0",
   "scripts":{  
      "start":"tsc && concurrently \"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.14",
      "systemjs":"0.19.25",
      "es6-shim":"^0.35.0",
      "reflect-metadata":"0.1.2",
      "rxjs":"5.0.0-beta.2",
      "zone.js":"0.6.6"
   },
   "devDependencies":{  
      "concurrently":"^2.0.0",
      "lite-server":"^2.2.0",
      "typescript":"^1.8.9",
      "typings":"^0.7.12"
   }
}

1 个答案:

答案 0 :(得分:1)

你可能在行上有一个不可见的字符\r

"start":"tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",

该字符破坏了package.json文件的json解析。 尝试手动重写该部分文本,或使用正则表达式搜索在文本编辑器中删除它。