Victor
Victor

Reputation: 5353

Gulp error (module not found)

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.

Upvotes: 12

Views: 17081

Answers (2)

kedar kokil
kedar kokil

Reputation: 1393

This is what I did to solve the problem:

sudo npm install gulp && sudo npm install --save del && sudo gulp build

Upvotes: 3

Fabrizzin
Fabrizzin

Reputation: 116

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.

Upvotes: 10

Related Questions