我現在有點絕望。我開始使用npm以及grunt來改進我的開發工作流程。一切都很好,直到今天。突然間不再可能安裝npm-packages。我總是收到以下錯誤消息:不能再安裝npm包
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'grunt-targethtml' ]
2 info using [email protected]
3 info using [email protected]
4 error Error: Invalid version: "2.5"
4 error at Object.module.exports.fixVersionField (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:180:13)
4 error at /usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:29:38
4 error at Array.forEach (native)
4 error at normalize (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:28:15)
4 error at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:310:33)
4 error at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:124:33)
4 error at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:299:40
4 error at fs.js:266:14
4 error at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:103:5
4 error at Object.oncomplete (fs.js:107:15)
5 error If you need help, you may report this log at:
5 error <http://github.com/isaacs/npm/issues>
5 error or email it to:
5 error <[email protected]>
6 error System Linux 3.2.0-57-generic
7 error command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "grunt-targethtml"
8 error cwd /home/ch/web-app
9 error node -v v0.10.22
10 error npm -v 1.3.14
11 verbose exit [ 1, true ]
我沒有修改設置。 Linux今天只做了一些更新。這是自昨天以來發生的所有變化,但沒有關於node或npm的更新。另外,我無法在網絡上找到有關此錯誤的任何信息。
看來你在命令或package.json中提到了不正確的版本'2.5'。它必須是'x.y.z'。你可以發佈你的package.json嗎? – user568109
@ user568109是的,你是對的,那是問題所在。我將版本更改爲2.5.0 – crebuh