Gulp: Invalid Version issue raised after installing Nodejs 8, npm 5.0

Created on 5 Jun 2017  路  4Comments  路  Source: gulpjs/gulp

Hello,

Installed Nodejs 8 with NPM 5.0, gulp is not working. Tried to downgrade Nodejs, NPM, but the issue still exists on Windows 10, though it was working without issues for months.

Error code received:
`node_modules\gulp\node_modules\semver\semver.js:295
throw new TypeError('Invalid Version: ' + version);
^

TypeError: Invalid Version: https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz`

I've seen the closed issue regarding "Invalid Version" exception happening in SemVer.
The only workaround working for me could be found below. Running gulp -v doesn't help in my case:
gulp -v CLI version 3.9.1 Local version https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz

`gulp -v

CLI version 3.9.1
Local version https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz`

The only solution working for me:
Editing global and local code and adding the following code from line 293 of
~./User/AppData/Roaming/npm/node_modules/gulp/node_modules/semver
m = [ '3.9.1', '3', '9', '1', undefined, undefined, {index: 0}, {input: '3.9.1'} ];
and the same for local installation of gulp.

Environment:
`node -v

v8.0.0`

`npm -v

5.0.0`

Most helpful comment

New npm seems to be extremely broken. This is not a gulp issue.

All 4 comments

Probably related to this issue about npm v5.x installs being janky on Docker: https://github.com/npm/npm/issues/16807. I also get this issue with Gulp, though on a Docker container.

New npm seems to be extremely broken. This is not a gulp issue.

So what's the solution? Can one fallback to a previous version of npm? I can't seem to find a simple answer online.

Try to install npm@latest via npm i npm@latest -g

Was this page helpful?
0 / 5 - 0 ratings