Gulp not working in old projects

Hi, I have a couple of old projects that I still maintain. Recently I can’t run gulp with these projects any more. When I run gulp I now get an error: “No command ‘gulp’ found”.

I have tried to install gulp-cli, even though it should already be installed, but now when running gulp I get this error message:
"internal/modules/cjs/loader.js:583
throw err;
^

Error: Cannot find module ‘internal/util/types’
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at evalmachine.:44:31
at Object. (/var/www/html/Kornit/website/wp-content/themes/kornit/node_modules/gulp/node_modules/graceful-fs/fs.js:11:1)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
"

How do I go about this?

Thanks!!

Update:
I have just now installed gulp and bower again globally, by running
npm install -g gulp bower

But I get the same error message as before.

Which error? You posted two.

If your system can’t find the gulp command after installing gulp-cli that sounds like an issue with your system PATH.

If gulp starts but has trouble running, a decent first step is to remove your project’s node_modules and reinstall your dependencies.

1 Like

Yeah, often if you’re run updates on your computer since the last time you ran gulp (for instance, yesterday’s MacOS Mojave release) you’ll need to delete and re-install your dependencies:

$ rm -rf node_modules
$ npm install