Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 600
tldr Avatar asked Sep 11 '13 14:09

tldr


2 Answers

C:\Program Files\nodejs>npm cache verify

Fixes it on Windows 10, run it with an Administrator command prompt Window.

like image 74
Robert Stefanz Avatar answered Sep 20 '22 13:09

Robert Stefanz


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".

like image 41
hexacyanide Avatar answered Sep 20 '22 13:09

hexacyanide