Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MODULE_NOT_FOUND error while using version 7.0.0 #241

Closed
kovalenkovpu opened this issue Sep 3, 2021 · 2 comments
Closed

MODULE_NOT_FOUND error while using version 7.0.0 #241

kovalenkovpu opened this issue Sep 3, 2021 · 2 comments

Comments

@kovalenkovpu
Copy link

Steps to reproduce:

  1. Create a new project so it has the following structure:
  project-name
    | src
        | index.js
    | package.json
    | package-lock.json
    | gulpfile.js
  1. Add any valid js code into src/index.js
  2. Add code below to thegulpfile.js file
const gulp = require("gulp");
const webpack = require("webpack-stream");

gulp
  .src("./src/index.js")
  .pipe(
    webpack({
      output: {
        filename: "bundle.js",
      },
    })
  )
  .pipe(gulp.dest("dist/"));

module.exports.default = gulp.series(bundle);
  1. Run gulp script using gulp-cli, or npm script (e.g. "build": "npm run gulp")

Expected result:

bundle.js file in the dist folder

Actual result:

Error stack:

Error: Cannot find module 'webpack/lib/ProgressPlugin'
Require stack:
- gulp-example/node_modules/webpack-stream/index.js
- gulp-example/gulpfile.js
- gulp-example/node_modules/gulp/node_modules/gulp-cli/lib/shared/require-or-import.js
- gulp-example/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js
- gulp-example/node_modules/gulp/node_modules/gulp-cli/index.js
- gulp-example/node_modules/gulp/bin/gulp.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/Pavel_Kovalenkov/projects/gulp-example/node_modules/webpack-stream/index.js:10:24)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'gulp-example/node_modules/webpack-stream/index.js',
    'gulp-example/gulpfile.js',
    'gulp-example/node_modules/gulp/node_modules/gulp-cli/lib/shared/require-or-import.js',
    'gulp-example/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js',
    'gulp-example/node_modules/gulp/node_modules/gulp-cli/index.js',
    'gulp-example/node_modules/gulp/bin/gulp.js'
  ]
}

Nodejs and dependencies versions:

Environment Info
nodejs 14.15.4
gulp 4.0.2
webpack-stream 7.0.0
System MacOS Big SUr 11.4

Everything works as expected with the previous version of the webpack-stream - 6.1.2

@shama
Copy link
Owner

shama commented Sep 3, 2021

Run npm i webpack.

npm WARN webpack-stream@7.0.0 requires a peer of webpack@^5.21.2 but none is installed. You must install peer dependencies yourself.

This is because webpack is now a peer dependency in 7.0.0 as many have requested for it to be a peer dependency. FWIW, I personally think peer dependencies are totally broken, inconsistent and provide a poor user experience. I think webpack should just be dependency.

But I guess this could be an experiment to see if more people run into module not found versus people asking for webpack to be a peer dependency.

@keyiis
Copy link

keyiis commented Dec 7, 2021

same issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants