无法解析package.json:npm install

时间:2015-10-27 09:19:23

标签: json node.js

当我发出" $ npm install"然后没有解析package.json。

我在ubuntu 14.04上使用NPM版本v2.11.2。

的package.json

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

    }
}

报告了以下错误:

:~/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

无法找到我错的地方。

1 个答案:

答案 0 :(得分:1)

  

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

express的版本号看起来不对。您可以使用*代替一个或多个版本号;即; 3.0.*匹配版本3的任何次要版本。但它无法替换.