gulp cannot run with npm 4.6.1+

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

node -v:
v6.10.1

npm -v:
4.6.1

To run: gulp

[15:36:21] Using gulpfile ~/Sites/MyApp/gulpfile.js
[15:36:21] Starting 'sass'...
[15:36:21] Finished 'sass' after 28 ms
[15:36:21] Starting 'sprite'...
[15:36:21] Finished 'sprite' after 13 ms
[15:36:21] Starting 'typescript'...
[15:36:23] Finished 'typescript' after 1.73 s
[15:36:23] Starting 'default'...
[15:36:23] Finished 'default' after 3.48 渭s

With npm 5.0.1 or 5.0.4 (tested these 2 versionS only) using node v6.10.1. It returns error messages:

/usr/local/lib/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
    at new SemVer (/usr/local/lib/node_modules/gulp/node_modules/semver/semver.js:295:11)
    at SemVer.compare (/usr/local/lib/node_modules/gulp/node_modules/semver/semver.js:348:13)
    at compare (/usr/local/lib/node_modules/gulp/node_modules/semver/semver.js:571:31)
    at Function.gt (/usr/local/lib/node_modules/gulp/node_modules/semver/semver.js:600:10)
    at Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/bin/gulp.js:99:14)
    at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:198:16)
    at module.exports (/usr/local/lib/node_modules/gulp/node_modules/flagged-respawn/index.js:17:3)
    at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:190:9)
    at /usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:164:9
    at /usr/local/lib/node_modules/gulp/node_modules/v8flags/index.js:110:14

I have tried to run node ./node_modules/gulp/bin/gulp -v then run node ./node_modules/gulp/bin/gulp but still nor working.

However if I install node module with yarn, it works:

rm -rf ./node_modules
yarn
gulp

Most helpful comment

npm: 5.0.3
node: v8.1.2
gulp: CLI version 1.2.2
gulp: Local version 4.0.0-alpha.2

I had the error with semver.js, turns out the the package-lock.json file in our repo was way off from what it should have been, the content it generated was completely wrong.

Try deleting your node_modules/ folder as well as your package-lock.json, then npm cache clean --force and finally npm install

All 4 comments

is any other solutions?

npm: 5.0.3
node: v8.1.2
gulp: CLI version 1.2.2
gulp: Local version 4.0.0-alpha.2

I had the error with semver.js, turns out the the package-lock.json file in our repo was way off from what it should have been, the content it generated was completely wrong.

Try deleting your node_modules/ folder as well as your package-lock.json, then npm cache clean --force and finally npm install

Npm issue, not gulp.

Weird stuff had the same issue. Using yarn instead of npm install works, if you have the possibility to use that instead.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonira picture jonira  路  3Comments

joe-watkins picture joe-watkins  路  5Comments

silverskyvicto picture silverskyvicto  路  3Comments

lgg picture lgg  路  3Comments

borodean picture borodean  路  5Comments