Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gulp command giving errors of modules can not find

I am trying to set up the basic aurelia app on windows. I have followed instructions from: http://aurelia.io/get-started.html, which includes:

  1. Installed node js
  2. Installed the gulp using: npm install -g gulp
  3. Installed jspn by using: npm install -g jspm
  4. Then downloaded the sample source code from https://github.com/aurelia/skeleton-navigation/releases to the project folder.
  5. Opened a console and changed to project directory ie. navigation-app
  6. Executed the command : npm install
  7. Executed the command: jspm install -y
  8. Finally launched the server using command: gulp watch

All above steps are completed successfully except step 8, which is giving an error :

E:\aurelia\navigation-app>gulp watch
module.js:338
    throw err;
          ^
Error: Cannot find module 'debug/node'
    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> (E:\aurelia\navigation-app\node_modules\gulp-babel\nod
e_modules\babel-core\lib\babel\util.js:22:34)
    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 Module.require (module.js:365:17)
    at require (module.js:384:17)

I am not getting why it can not find modules. If I install that module manually it gives error message for another module when I try to run : gulp watch

like image 405
vish Avatar asked Apr 04 '15 12:04

vish


People also ask

How to fix “Laravel-elixir not found” on gulp?

If you also find error like "laravel-elixir not found" on gulp then you can install laravel-elixir npm package manually. I also fetch this error when i was new in laravel and working with gulp first time.

Why can't node_modules Find my gulpfile?

Your gulpfile is wayyy too deep and your node_modules are way too high up the tree. node only looks up a few directories for node_modules before saying it couldn't find it. Look at the npm/node docs for more info, but it needs to be closer.

How to fix form data module is not found?

For example, if the error is: { [Error: Cannot find module '/root/.npm/form-data'] code: 'MODULE_NOT_FOUND' } then you can resolve this issue by executing the command npm install --save form-data. Share Follow edited May 26 '17 at 21:15 bruntime 37122 silver badges1313 bronze badges answered Jun 17 '15 at 8:51

How to resolve NPM module cannot be found error?

{ [Error: Cannot find module '/root/.npm/form-data'] code: 'MODULE_NOT_FOUND' } then you can resolve this issue by executing the command npm install --save form-data.


Video Answer


2 Answers

I have also been battling this problem since upgrading Aurelia and related tools to the latest versions. It may be related to path length/depth issues on Windows with the native Module.require.

When I uninstalled the following packages from the project's local node_modules folder and instead installed them in the global NPM cache (which lives at a more shallow directory depth in my case), gulp build started working again:

npm uninstall gulp-babel
npm uninstall browser-sync
npm uninstall karma

npm install -g gulp-babel
npm install -g browser-sync
npm install -g karma
like image 173
Craigology Avatar answered Oct 22 '22 15:10

Craigology


I had the exact same error, and since debug/node is not actually a package, I was very confused for days. But this is the solution that worked for me. Pretty dumb and easy, but I'm re-posting here hoping that it will save someone else's days..

In short, the solution is to remove the node_modules folder inside the application and running npm install again.

like image 1
jeff Avatar answered Oct 22 '22 15:10

jeff