tldr tldr - 1 year ago 348
JSON Question

npm install error - invalid package.json

I'm using this tutorial to understand implementing oauth2 in Node.js.

This is my package.json:

{
"name": "application-name",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "coffee -w server.coffee"
},
"dependencies": {
"express": "3.3.4",
"jade": "*",
"coffee-script": "latest",
"passport-http": "latest",
"passport-http-bearer": "latest",
"passport-oauth2-client-password": "latest",
"oauth2orize": "latest",
"debug" "~0.7.2"
}
}


I'm getting the error:

npm ERR! install Couldn't read dependencies
npm ERR! Failed to parse json
npm ERR! Unexpected string
npm ERR! File: /Users/jashua/Desktop/auth/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! System Darwin 12.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/jashua/Desktop/auth
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.3.5
npm ERR! file /Users/jashua/Desktop/auth/package.json
npm ERR! code EJSONPARSE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/me/Desktop/auth/npm-debug.log
npm ERR! not ok code 0


Any ideas what's wrong with my package.json?

Answer Source

The error means exactly what it states, the JSON in your package.json is not valid and can't be parsed properly. Change "debug" "~0.7.2" to "debug": "~0.7.2".