当我在项目文件夹中运行npm install
时,它会被终止
错误显示在终端(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
我附上了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 ]
这是我的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"
}
}
我正在使用npm version 2.15.1
和node version v4.4.3
。
答案 0 :(得分:4)
您的应用版本无效。 该版本应包含3个部分,而您有4个部分:
"version": "0.1.2.0"
将版本更新为此版本,它应该可以正常工作:
"version": "0.1.2"
NPM正在使用semver,其中版本(主要,次要和补丁)中有3个(不是4个)部分除以点符号。