简体   繁体   English

npm install终止,错误为“安装无法读取依赖项”

[英]npm install is terminate with error “install Couldn't read dependencies”

When I run npm install inside my project folder, it gets terminated. 当我在项目文件夹中运行npm install ,它将终止。
Errors show up in terminal (MacOS X): 错误显示在终端(MacOS X)中:

npm ERR! install Couldn't read dependencies
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.4.3
npm ERR! npm  v2.15.1

npm ERR! Invalid version: "0.1.2.0"
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Orion/NodeWorks/WebDev/npm-debug.log

Here i have attached the npm-debug.log : 在这里我附上了npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'install' ]
2 info using npm@2.15.1
3 info using node@v4.4.3
4 verbose readDependencies loading dependencies from /Users/Orion/NodeWorks/WebDev/package.json
5 error install Couldn't read dependencies
6 verbose stack Error: Invalid version: "0.1.2.0"
6 verbose stack     at Object.module.exports.fixVersionField (/usr/local/lib/node_modules/npm/node_modules/normalize-package-data/lib/fixer.js:191:13)
6 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js:32:38
6 verbose stack     at Array.forEach (native)
6 verbose stack     at normalize (/usr/local/lib/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js:31:15)
6 verbose stack     at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:338:5)
6 verbose stack     at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:113:5)
6 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:232:12
6 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16
6 verbose stack     at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
7 verbose cwd /Users/Orion/NodeWorks/WebDev
8 error Darwin 15.4.0
9 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
10 error node v4.4.3
11 error npm  v2.15.1
12 error Invalid version: "0.1.2.0"
13 error If you need help, you may report this error at:
13 error     <https://github.com/npm/npm/issues>
14 verbose exit [ 1, true ]

And here is my package.json : 这是我的package.json

{
  "name": "*****",
  "version": "0.1.2.0",
  "private": true,
  "description": "Packages for the web site ****.com",
  "main": "server.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node server.js"
  },
  "author": "*****",
  "license": "ISC",
  "dependencies": {
    "async": "^2.0.0-rc.3",
    "bcryptjs": "^2.3.0",
    "body-parser": "^1.15.0",
    "cookie-parser": "^1.4.1",
    "debug": "^2.2.0",
    "del": "^2.2.0",
    "elasticsearch": "^11.0.1",
    "emailjs": "^1.0.4",
    "express": "^4.13.4",
    "express-session": "^1.13.0",
    "gulp-coffee": "^2.3.2",
    "gulp-concat": "^2.6.0",
    "gulp-imagemin": "^2.4.0",
    "gulp-sourcemaps": "^2.0.0-alpha",
    "gulp-uglify": "^1.5.3",
    "gulp-util": "^3.0.7",
    "html-metadata": "^1.4.1",
    "jade": "^1.11.0",
    "knex": "^0.10.0",
    "lodash": "^4.11.1",
    "mongoosastic": "^4.0.2",
    "mongoose": "^4.4.13",
    "morgan": "^1.6.1",
    "nodemailer": "^2.3.2",
    "passport": "^0.3.2",
    "passport-local": "^1.0.0",
    "python-shell": "^0.4.0",
    "q": "^1.4.1",
    "request": "^2.69.0",
    "serve-favicon": "^2.3.0",
    "speakingurl": "^9.0.0",
    "urlencode": "^1.1.0"
  },
  "devDependencies": {
    "chai": "^3.5.0",
    "grunt": "^1.0.1",
    "gulp": "^3.9.1",
    "gulp-jade": "^1.1.0",
    "mocha": "^2.4.5"
  }
}

I am using npm version 2.15.1 and node version v4.4.3 . 我正在使用npm version 2.15.1node version v4.4.3

You have an invalid version of your app. 您的应用程序版本无效。 The version should contain of 3 parts, whereas you have 4: 版本应包含3个部分,而您有4个部分:

"version": "0.1.2.0"

Update the version to this and it should work fine: 将版本更新为此,应该可以正常工作:

"version": "0.1.2"

NPM is using semver which has 3 (not four) parts in the version (major, minor and patch) divided by dot sign. NPM正在使用semver ,该版本在版本(主要,次要和补丁)中有3个(不是四个)部分,并用点号分开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM