Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gulp no longer working after upgrading to node.js 4.1

Tags:

node.js

npm

gulp

I just upgraded from node 0.12.x to 4.1.0. After doing so gulp no longer works. Here is what I'm seeing in the console after I try to run gulp

module.js:338
throw err;
^

Error: Cannot find module '/Users/me/.node/lib/node_modules/gulp/node_modules/v8flags/cache/4.5.103.35.flags.json'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/me/.node/lib/node_modules/gulp/bin/gulp.js:25:22)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:475:10)

I've tried running npm install, and updating to the latest version of gulp but that didn't fix the problem. Any ideas on how to fix this?

like image 892
Chris Paterson Avatar asked Oct 06 '15 20:10

Chris Paterson


People also ask

What version of Node works with Gulp 4?

Gulp 3.9. 1 will work with Node 8 (latest noded 8 is 8.17.

What is NPM install Gulp?

Automatically install npm, bower, tsd, typings, composer and pip packages/dependencies if the relative configurations are found in the gulp file stream respectively. Primary objective. Installation. For global use with slush.

What is NPM and Gulp?

Gulp is yet another tool from open source community to automate repetitive tasks in web development. While tools like bower, npm (Node Package Manager) helps us to download and configure re-usable packages in our application, Gulp helps us to automate many of the time consuming repetitive client side tasks.


2 Answers

You can fix it by deleting the "npm" and "npm-cache" folders in "/usr/local/".

Then do a

 "npm install -g npm"

Followed by:

"npm install -g gulp"

Everything should now be updated and ready to rock!

EDIT: On Windows the folders can be found in "/users/(username)/AppData/Roaming"

like image 99
Christian A Avatar answered Oct 21 '22 08:10

Christian A


Delete the Gulp module in the error, so in your case delete this folder

/Users/me/.node/lib/node_modules/gulp

Then clean your npm cache:

$ npm cache clean

And finally install Gulp globally again:

$ npm install -g gulp

Then you should find it works again - I did!

like image 32
Simon Holmes Avatar answered Oct 21 '22 08:10

Simon Holmes