Gulp errors (Cannot find module ...)

I am trying to get Sage up and running and spent a couple of hours troubleshooting gulp.

After running:
npm install
gulp

I get:

Error: Cannot find module ‘gulp-concat’ …

npm install gulp-concat --save

then:
Error: Cannot find module ‘gulp-flatten’ …

…etc

then (full error copied):

module.js:471
throw err;
^

Error: Cannot find module ‘debug’
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/Applications/AMPPS/www/wpshala.dev/wp-content/themes/wpshala-sage/node_modules/lazy-debug-legacy/src/index.js:1:75)
at Module._compile (module.js:570:32)
at Object.Module._extensions…js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

Basically it is failing at each module


If I try:
npm cache clear && rm -rf node_modules && npm install

I get:
npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use ‘npm cache verify’ instead.
npm ERR!
npm ERR! If you’re sure you want to delete the entire cache, rerun this command with --force.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Yan/.npm/_logs/2017-10-19T16_13_52_032Z-debug.log


npm cache verify completes

I also tried:
npm cache clear --force && rm -rf node_modules --force && npm install --force

and:
npm install -g npm@latest

Next I tried deleting node_modules folder and again running npm install (which does install all the modules)


Versions:

node -v && npm -v && gulp -v
v6.11.3
5.5.1
[17:32:26] CLI version 3.9.1
[17:32:26] Local version 3.9.1


I found a few kind of similar issues on here to do with gulp but no resolution yet

Maybe give nvm a shot for managing your Node.js install?

Just wondering why that would help?

➜ wpshala-sage git:(master) ✗ node -v
v6.11.3
➜ wpshala-sage git:(master) ✗ which node
/usr/local/bin/node

That all looks ok to me… and I havent seen these problems with any other builds.

But if you are certain that is a necessary step to solve the issue I can try it

Did you clone Sage 9 and try to run Sage 8 commands?

This topic is tagged as sage9 and gulp, but gulp is used in Sage 8

I ran composer create-project roots/sage wpshala-sage 8.5.3

Incorrectly tagged!

I am facing the same errors…