Gulp error (module not found)

I installed npm locally according to the article (I don’t remember the URL). So my npm packages are in ~/.npm-packages/ . So gulp is in ~/.npm-packages/bin/gulp , and this is the link: gulp -> ../lib/node_modules/gulp/bin/gulp.js

When I ran which gulp , I got /home/victor/.npm-packages/bin/gulp

When I go to the bin directory and run gulp as ./gulp.js -v , I see that it works. However, when I run gulp globally, I got this error:

 module.js:338 throw err; ^ Error: Cannot find module '/usr/lib/node_modules/gulp/node_modules/v8flags/3.28.73.flags.json' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:278:25) at Module.require (module.js:365:17) at require (module.js:384:17) at Object.<anonymous> (/usr/lib/node_modules/gulp/bin/gulp.js:25:22) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Function.Module.runMain (module.js:501:10) 

So gulp is trying to find the modules in / usr / lib, but why? Why not in my home directory? I have all these modules in ~/.npm-packages/lib/node_modules/gulp/node_modules

I am absolutely confused and cannot work gulp. I tried reinstalling it with the same effect.

+8
npm gulp
source share
1 answer

Here is what I did to solve the problem:

  • cd / usr / lib / node_modules / gulp / node_modules / v8flags
  • sudo node fetch.js

What is it. The last command will create the required file.

+9
source share

All Articles