crebuh
crebuh

Reputation: 357

Cannot install npm package anymore

I'm a bit desperate right now. I started using npm as well as grunt to improve my development workflow. Everything worked well until today. Suddenly it is no longer possible to install npm-packages. I always got the following error message:

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 ]

I did not modify the setup. Linux only did some updates today. That was everything that has been changed since yesterday, but no updates concerning node or npm. In addition I can't find anything regarding this error on the web.

Upvotes: 0

Views: 667

Answers (2)

Paul Mougel
Paul Mougel

Reputation: 17038

The version number you're using doesn't comply with the semantic versionning convention npm uses: you need to specify aMAJOR.MINOR.PATCH version number.

You can either:

  1. Use the 0.2.x notation to specify that you don't care what patch version you use, as long as the major.minor matches
  2. Use the ~0.2.0 notation to specify that you don't care what patch version you use, as long as the major.minor matches
  3. Read npm's documentation and semver's documentation for other possibilities...

Upvotes: 1

vmx
vmx

Reputation: 8397

grunt-targethtml latest is at version 0.2.6, probably you're using v0.2.5. Can you update your package.json, to include version 0.2.5 for grunt-targethtml?

Upvotes: 0

Related Questions