Amrit Pal Singh
Amrit Pal Singh

Reputation: 13

during npm install getting Failed to parse package.json data

during npm install on windows 10 i am getting this error I am using node v6.10.3 and npm v3.10.10

please help to correct this.

error I am getting

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 file contents:

{  
   "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"
   }
}

Upvotes: 1

Views: 1953

Answers (1)

Omri Luzon
Omri Luzon

Reputation: 4224

You probably have an invisible character \r at line:

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

That character breaks the json parsing of the package.json file. Try to rewrite that part of the text by hand, or use a regex search to delete it in your text editor.

Upvotes: 1

Related Questions