Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find module 'require-dir' error while running gulp app:serve rails

I installed npm, bower and gulp. But while running gulp app:serve, I am getting the following error. Please help me. This is the command I run: sachin@sachin:~/Desktop/workspace/myproj/angular/ex (master)$gulp app:serve

Result I got:

Error: Cannot find module 'require-dir'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/sachin/Desktop/workspace/myproj/angular/ex/gulpfile.js:14:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
like image 510
sachin god Avatar asked Dec 17 '15 07:12

sachin god


People also ask

Can not find module Gulp?

Install the gulp-sass module manually If you don't see the gulp-sass package in your node_modules folder, or are still having issues, you can try reinstalling the package. First, open your package. json and package-lock. json files and remove any references to gulp-sass and node-sass that you see.

Can not find module error?

The Cannot find module error is a common error that usually happens when dependencies are not installed. Once you install your dependencies and ensure that the paths are correct, you can resolve the error and run your application successfully.

How do I run gulp locally?

To install Gulp locally, navigate to your project directory and run npm install gulp . You can save it to your package. json dependencies by running npm install gulp --save-dev . Once you have Gulp installed locally, you can then proceed to create your gulpfile.

Can't find module after npm install?

If you have run the npm install command before, then it's possible that the installation of the module is incomplete or corrupted. Delete the node_modules/ folder using the rm -rf node_modules command, then run npm install again. That may fix the issue.


1 Answers

Error: Cannot find module 'require-dir'

You've installed gulp but have not installed its tasks' dependencies. E.g. if a gulp task has any require('') calls, then it depends on require-dir. Those dependencies are probably in your project's package.json file. To install all the dependencies run:

npm install 
like image 175
Shaun Luttin Avatar answered Sep 28 '22 20:09

Shaun Luttin