aruns23
aruns23

Reputation: 21

Failed to parse package.json : npm install

When I issue "$npm install" then package.json is not getting parsed.

I am using NPM version v2.11.2 on ubuntu 14.04.

package.json

{
    "name": "sockjs-express",
    "version": "0.0.0-unreleasable",
    "dependencies": {
        "express": "~3*",
        "sockjs": "*",
        "hiredis": "*",
        "redis": "*"

    }
}

Following error is reported :

:~/sfax/djangotest/sockjs_serv$ sudo npm install
npm ERR! install Couldn't read dependencies
npm ERR! Linux 3.13.0-48-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--production"
npm ERR! node v0.12.5
npm ERR! npm  v2.11.2
npm ERR! file /home/ubuntu/sfax/djangotest/sockjs_serv/package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token '/' at 9:10
npm ERR!         "/home/ubuntu/sfax/djangotest/sockjs_serv/npm-debug.log",
npm ERR!          ^
npm ERR! File: /home/ubuntu/sfax/djangotest/sockjs_serv/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!     /home/ubuntu/sfax/djangotest/sockjs_serv/npm-debug.log

Unable to get where am I going wrong.

Upvotes: 1

Views: 1745

Answers (1)

Jivings
Jivings

Reputation: 23262

Version must be parseable by node-semver, which is bundled with npm as a dependency. (npm install semver to use it yourself.)

Your version number for express looks wrong. You can use the * to stand in for one or more of the version numbers; ie; 3.0.* matches any minor version of version 3. But it can't replace the ..

Upvotes: 1

Related Questions