2016-04-24 421 views
1

當我在我的項目文件夾中運行npm install時,它終止。
錯誤在終端顯示(MacOS X系統):npm安裝終止時出現錯誤「安裝無法讀取依賴關係」

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 [email protected] 
3 info using [email protected] 
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.1node version v4.4.3

回答

4

您的應用程序版本無效。 版本應該包含3個部分組成,而你有4個:

"version": "0.1.2.0" 

更新的版本,這和它應該很好地工作:

"version": "0.1.2" 

NPM使用semver其中有3個(而不是四個)版本中的部分(主要,次要和補丁)除以點號。

+0

非常感謝。有效! –