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

Release 0.32.0 breaks with Error: Cannot find module '@symfony/stimulus-bridge/webpack-helper' #861

Closed
jonathantullett opened this issue Dec 3, 2020 · 6 comments · Fixed by #863

Comments

@jonathantullett
Copy link

Release 0.32.0 is causing a few problems.

My package.json:

{
    "devDependencies": {
        "@symfony/webpack-encore": "^0.32.0",
        "bootstrap": "^4.5.3",
        "core-js": "^3.0.0",
        "jquery": "^3.5.1",
        "node-sass": "4.14",
        "popper.js": "^1.16.1",
        "regenerator-runtime": "^0.13.2",
        "sass-loader": "^9.0.1",
        "vue": "^2.5",
        "vue-loader": "^15",
        "vue-template-compiler": "^2.6.12",
        "webpack-notifier": "^1.6.0"
    },
    "license": "UNLICENSED",
    "private": true,
    "scripts": {
        "dev-server": "encore dev-server",
        "dev": "encore dev",
        "watch": "encore dev --watch",
        "build": "encore production --progress"
    }
}

What happens:

/app $ yarn add @symfony/webpack-encore --dev
yarn add v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: Invalid bin field for "mini-css-extract-plugin".
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
warning " > [email protected]" has unmet peer dependency "css-loader@*".
warning " > [email protected]" has unmet peer dependency "webpack@^3.0.0 || ^4.1.0 || ^5.0.0-0".
[4/4] Building fresh packages...
success Saved lockfile.
warning Your current version of Yarn is out of date. The latest version is "1.22.5", while you're on "1.22.4".
info To upgrade, run the following command:
$ apk update && apk add -u yarn
success Saved 2 new dependencies.
info Direct dependencies
└─ @symfony/[email protected]
info All dependencies
├─ @symfony/[email protected]
└─ [email protected]
Done in 20.09s.
/app $ yarn encore production
yarn run v1.22.4
$ /app/node_modules/.bin/encore production
Running webpack ...

/app/node_modules/webpack-cli/bin/cli.js:93
				throw err;
				^

Error: Cannot find module '@symfony/stimulus-bridge/webpack-helper'
Require stack:
- /app/node_modules/@symfony/webpack-encore/lib/plugins/stimulus-bridge.js
- /app/node_modules/@symfony/webpack-encore/lib/config-generator.js
- /app/node_modules/@symfony/webpack-encore/index.js
- /app/webpack.config.js
- /app/node_modules/webpack-cli/bin/utils/convert-argv.js
- /app/node_modules/webpack-cli/bin/cli.js
- /app/node_modules/webpack/bin/webpack.js
- /app/node_modules/@symfony/webpack-encore/bin/encore.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (/app/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/app/node_modules/@symfony/webpack-encore/lib/plugins/stimulus-bridge.js:13:22)
    at Module._compile (/app/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (/app/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/app/node_modules/@symfony/webpack-encore/lib/config-generator.js:43:24)
    at Module._compile (/app/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (/app/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/app/node_modules/@symfony/webpack-encore/index.js:15:25)
    at Module._compile (/app/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (/app/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/app/webpack.config.js:1:76)
    at Module._compile (/app/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (/app/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at WEBPACK_OPTIONS (/app/node_modules/webpack-cli/bin/utils/convert-argv.js:114:13)
    at requireConfig (/app/node_modules/webpack-cli/bin/utils/convert-argv.js:116:6)
    at /app/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17
    at Array.forEach (<anonymous>) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/app/node_modules/@symfony/webpack-encore/lib/plugins/stimulus-bridge.js',
    '/app/node_modules/@symfony/webpack-encore/lib/config-generator.js',
    '/app/node_modules/@symfony/webpack-encore/index.js',
    '/app/webpack.config.js',
    '/app/node_modules/webpack-cli/bin/utils/convert-argv.js',
    '/app/node_modules/webpack-cli/bin/cli.js',
    '/app/node_modules/webpack/bin/webpack.js',
    '/app/node_modules/@symfony/webpack-encore/bin/encore.js'
  ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Building with the previous version: @symfony/[email protected] works fine:

/app $ yarn add @symfony/[email protected] --dev
yarn add v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: Invalid bin field for "mini-css-extract-plugin".
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
warning " > [email protected]" has unmet peer dependency "css-loader@*".
warning " > [email protected]" has unmet peer dependency "webpack@^3.0.0 || ^4.1.0 || ^5.0.0-0".
[4/4] Building fresh packages...
warning Your current version of Yarn is out of date. The latest version is "1.22.5", while you're on "1.22.4".
info To upgrade, run the following command:
$ apk update && apk add -u yarn
success Saved 0 new dependencies.
Done in 20.07s.
/app $ yarn encore production
yarn run v1.22.4
$ /app/node_modules/.bin/encore production
Running webpack ...

 RECOMMEND  To create a smaller (and CSP-compliant) build, see https://symfony.com/doc/current/frontend/encore/vuejs.html#runtime-compiler-build
 DONE  Compiled successfully in 8672ms                                                                                                                    11:42:34 AM

 I  11 files written to public/build

Is this something I'm doing wrong, or something within the release that's not quite right?

Thank you.

@gremo
Copy link

gremo commented Dec 3, 2020

I confirm, same problem here.

@Kocal
Copy link
Member

Kocal commented Dec 3, 2020

Hi,

Temporarily you will have to install it explicitly even if you don't use Stimulis, run yarn add -D @symfony/stimulus-bridge and it should do the job.

However, the best way would be to fix it in Encore directly:

  • only load @symfony/stimulus-bridge when needed (if you use .enableStimulusBridge() in your config)
  • ensure the dependency exists before trying to use it, like we do with Sass, PostCSS, Vue ...

I'm working on it.

@gremo
Copy link

gremo commented Dec 3, 2020

@Kocal thanks for helping, it's not worth it for me, I'll skip and wait for the next version (hope PostCSS 8 support very soon)!

@Kocal
Copy link
Member

Kocal commented Dec 3, 2020

PR #863 should fix the issue.

@weaverryan
Copy link
Member

Try 0.32.1 and please let us know if you have any continued issues :)

@jonathantullett
Copy link
Author

Fixed for me now. Thank you @weaverryan.

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

Successfully merging a pull request may close this issue.

4 participants