Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gulp error (module not found)

Tags:

node.js

npm

gulp

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

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

When I go to the bin directory and run gulp like ./gulp.js -v I can see it works. However, when I run gulp globally I got such 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 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'm absolutely confused and can't get gulp working. I've tried to reinstall it with the same effect.

like image 572
Victor Avatar asked Mar 30 '15 12:03

Victor


2 Answers

This is what I did to solve the problem:

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

And that's it. The last instruction will create the required file.

like image 157
Fabrizzin Avatar answered Oct 26 '22 19:10

Fabrizzin


This is what I did to solve the problem:

sudo npm install gulp && sudo npm install --save del && sudo gulp build
like image 38
kedar kokil Avatar answered Oct 26 '22 20:10

kedar kokil