Gulp - Cannot find module 'gulp-rename'

First, make sure that gulp-rename is listed in your package.json under dependencies or devDependencies. Then run:

npm uninstall -g gulp
npm install -g gulp
rm -rf node_modules
npm install 

Then check again.


install the gulp-rename package from cli:

npm install --save-dev gulp-rename

then import the package from node_modules

const rename = require("gulp-rename");

use it before compiling

Example:

const miniCSS = () => {
    return gulp.src('./css/*.css')
    .pipe(rename('style.min.css'))
    .pipe(uglifycss({
        "uglyComments": true
    }))
    .pipe(gulp.dest('./dist/'))
}