Home > database >  Gulpfile.js - module not found
Gulpfile.js - module not found

Time:12-28

First time posting, please be gentle...

Trying to follow along with Kevin Powell tutorial on setting up gulp to automate some SCSS compiling etc - link below

https://www.youtube.com/watch?v=QgMQeLymAdU&t=633s

Fairly confident I followed the instructions correctly but when trying to run the gulp style command I'm getting the following error.

node_modules seems to be set up correctly in the root folder when installed and package.json has gulp in the dependencies as well.

Any help would be fantastic.

Error: Cannot find module 'gulp;'
Require stack:
- C:\Users\Admin\OneDrive\Desktop\test\gulpfile.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\gulp\node_modules\gulp-cli\lib\shared\require-or-import.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\gulp\node_modules\gulp-cli\lib\versioned\^3.7.0\index.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\gulp\node_modules\gulp-cli\index.js
- C:\Users\Admin\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (C:\Users\Admin\OneDrive\Desktop\test\gulpfile.js:1:14)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Admin\\OneDrive\\Desktop\\test\\gulpfile.js',
    'C:\\Users\\Admin\\AppData\\Roaming\\npm\\node_modules\\gulp\\node_modules\\gulp-cli\\lib\\shared\\require-or-import.js',
    'C:\\Users\\Admin\\AppData\\Roaming\\npm\\node_modules\\gulp\\node_modules\\gulp-cli\\lib\\versioned\\^3.7.0\\index.js',
    'C:\\Users\\Admin\\AppData\\Roaming\\npm\\node_modules\\gulp\\node_modules\\gulp-cli\\index.js',
    'C:\\Users\\Admin\\AppData\\Roaming\\npm\\node_modules\\gulp\\bin\\gulp.js'
  ]
}

Tried deleting node_modules and npm install againw it the same issues.

CodePudding user response:

If you have any previously installed gulp globally, Uninstall them using the below command :

run npm rm --global

and then try running the below and install gulp-cli globally:

npm install --global gulp-cli

And then go to your project directory and run the below command:

npm install --save-dev gulp

Please find the official gulp documentation here

  • Related