npm semver version invalid issue with grunt installation

368 views Asked by At

While installing grunt, one of the errors is unmet dependency semver@4

i am using [email protected], [email protected]

i run two commands and it shows two versions and one is invalid

npm list -g

and in the tree it shows [email protected] invalid

now i run

npm view semver version

now it shows 4.1.0

i tried npm update semver but nothing happens

i have even tried to the solution provided in similar question npm error invalid semver

curl https://npmjs.org/install.sh | sh

but donesnt help

I am new to npm and grunt please help!

1

There are 1 answers

0
hereandnow78 On BEST ANSWER

what do you mean by While installing grunt? Installing the grunt-cli tools or the grunt-runner in your project?

since 4.0 grunt is split into 2 modules:

grunt-cli needs to be installed globally, and only 1 time:

$ npm install grunt-cli -g

grunt needs to be installed locally in every project where you want to use grunt and grunt-plugins:

$ npm install grunt

updating npm:

the crazy stuff about npm is, that you can even update npm via npm:

$ npm update npm -g

the current npm version is 2.1.9, so maybe this solves your problem.

hint: use nvm vor node.js version management. this solves multiple problems:

  1. easy version switching
  2. you don't need sudo for global packages