'Why do I get: "Error: cannot find module sass" when I run "gulp" in terminal?
I'm trying to run a gulp task but when I go to Terminal > Run Task... > gulp it says No gulp task found. I run gulp in the terminal and I get the title's error.
which sass: /home/username/.nvm/versions/node/v17.4.0/bin/sass.
which node: /home/username/.nvm/versions/node/v17.4.0/bin/node.
which gulp: /home/username/.nvm/versions/node/v17.4.0/bin/gulp.
Gulp version:
CLI version: 2.3.0
Local version: 4.0.2
Gulp sass version: ^5.1.0.
My gulpfile.js; is in the root folder (as my styles.scss, styles.css, styles.min.css, package.json, package-lock.json and node_modules/), with the code:
// Sass configuration
var gulp = require('gulp');
var sass = require('gulp-sass')(require('sass'));
gulp.task('sass', function(cb) {
gulp
.src('*.scss')
.pipe(sass())
.pipe(
gulp.dest(function(f) {
return f.base;
})
);
cb();
});
gulp.task(
'default',
gulp.series('sass', function(cb) {
gulp.watch('*.scss', gulp.series('sass'));
cb();
})
);
I removed and re-installed gulp and gulp-sass but the result is the same.
I'm following these steps.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
