electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.51k stars 521 forks source link

`The installed version of @vercel/webpack-asset-relocator-loader does not appear to be compatible with Forge` on new patch version of dev dependency `@vercel/webpack-asset-relocator-loader` #3600

Open eXhumer opened 6 months ago

eXhumer commented 6 months ago

Pre-flight checklist

Electron Forge version

7.4.0

Electron version

30.0.6

Operating system

macOS 14.4.1 (arm64)

Last known working Electron Forge version

No response

Expected behavior

Able to upgrade outdated dependency for a package without breaking development build.

Actual behavior

Upon running npm upgrade on package, I can no longer start the development build with start script as it fails with the following error.

Console output with errors ``` ➜ exhumer@EXHUMER-MACBOOK-AIR ~/Projects npm create electron-app hello-electron -- --template=webpack-typescript > npx > create-electron-app hello-electron --template=webpack-typescript ✔ Locating custom template: "webpack-typescript" ✔ Initializing directory ✔ Preparing template ✔ Initializing template ✔ Installing template dependencies ➜ exhumer@EXHUMER-MACBOOK-AIR ~/Projects cd hello-electron && npm start > hello-electron@1.0.0 start > electron-forge start ✔ Checking your system ✔ Locating application ✔ Loading configuration ✔ Preparing native dependencies [0.1s] ✔ Running generateAssets hook ✔ [plugin-webpack] Compiling main process code [0.3s] ✔ [plugin-webpack] Launching dev servers for renderer process code [0.9s] › Output Available: http://localhost:9000 [ForkTsCheckerWebpackPlugin] Type-checking in progress... [ForkTsCheckerWebpackPlugin] No errors found. [89591:0517/022137.671400:ERROR:CONSOLE(1)] "Request Autofill.enable failed. {"code":-32601,"message":"'Autofill.enable' wasn't found"}", source: devtools://devtools/bundled/core/protocol_client/protocol_client.js (1) ➜ exhumer@EXHUMER-MACBOOK-AIR ~/Projects/hello-electron git:(main) ✗ npm outdat`ed` Package Current Wanted Latest Location Depended by @typescript-eslint/eslint-plugin 5.62.0 5.62.0 7.9.0 node_modules/@typescript-eslint/eslint-plugin hello-electron @typescript-eslint/parser 5.62.0 5.62.0 7.9.0 node_modules/@typescript-eslint/parser hello-electron @vercel/webpack-asset-relocator-loader 1.7.3 1.7.4 1.7.4 node_modules/@vercel/webpack-asset-relocator-loader hello-electron css-loader 6.11.0 6.11.0 7.1.1 node_modules/css-loader hello-electron eslint 8.57.0 8.57.0 9.2.0 node_modules/eslint hello-electron fork-ts-checker-webpack-plugin 7.3.0 7.3.0 9.0.2 node_modules/fork-ts-checker-webpack-plugin hello-electron style-loader 3.3.4 3.3.4 4.0.0 node_modules/style-loader hello-electron typescript 4.5.5 4.5.5 5.4.5 node_modules/typescript hello-electron ➜ exhumer@EXHUMER-MACBOOK-AIR ~/Projects/hello-electron git:(main) ✗ npm upgrade added 13 packages, removed 11 packages, changed 6 packages, and audited 920 packages in 4s 184 packages are looking for funding run `npm fund` for details found 0 vulnerabilities ➜ exhumer@EXHUMER-MACBOOK-AIR ~/Projects/hello-electron git:(main) ✗ npm start > hello-electron@1.0.0 start > electron-forge start ✔ Checking your system ✔ Locating application ✔ Loading configuration ✔ Preparing native dependencies [0.1s] ✔ Running generateAssets hook ✔ [plugin-webpack] Compiling main process code [0.3s] ✖ [plugin-webpack] Launching dev servers for renderer process code › Compilation errors in the preload: group_0: asset main_window/preload.js 553 KiB [emitted] (name: main_window) runtime modules 26.3 KiB 12 modules modules by path ./node_modules/ 160 KiB modules by path ./node_modules/webpack-dev-server/client/ 71.8 KiB 16 modules modules by path ./node_modules/webpack/hot/*.js 5.18 KiB ./node_modules/webpack/hot/dev-server.js 1.94 KiB [built] [code generated] ./node_modules/webpack/hot/log.js 1.74 KiB [built] [code generated] + 2 modules modules by path ./node_modules/html-entities/lib/*.js 78.9 KiB ./node_modules/html-entities/lib/index.js 4.84 KiB [built] [code generated] ./node_modules/html-entities/lib/named-references.js 73.1 KiB [built] [code generated] ./node_modules/html-entities/lib/numeric-unicode-map.js 389 bytes [built] [code generated] ./node_modules/html-entities/lib/surrogate-pairs.js 583 bytes [built] [code generated] ./node_modules/ansi-html-community/index.js 4.16 KiB [built] [code generated] ./src/preload.ts 158 bytes [built] [code generated] external "events" 42 bytes [built] [code generated] ERROR in webpack/runtime/compat The installed version of @vercel/webpack-asset-relocator-loader does not appear to be compatible with Forge Error: The installed version of @vercel/webpack-asset-relocator-loader does not appear to be compatible with Forge at tapInfo.fn (/Users/exhumer/Projects/hello-electron/node_modules/@electron -forge/plugin-webpack/src/util/AssetRelocatorPatch.ts:45:23) at Hook.eval (eval at create (/Users/exhumer/Projects/hello-electron/node_mo dules/tapable/lib/HookCodeFactory.js:19:10), :9:16) at CompatRuntimeModule.generate (/Users/exhumer/Projects/hello-electron/node _modules/webpack/lib/runtime/CompatRuntimeModule.js:46:66) at CompatRuntimeModule.getGeneratedCode (/Users/exhumer/Projects/hello-elect ron/node_modules/webpack/lib/RuntimeModule.js:184:44) at CompatRuntimeModule.codeGeneration (/Users/exhumer/Projects/hello-electro n/node_modules/webpack/lib/RuntimeModule.js:139:30) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Compilati on.js:3463:22 at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Cache.js: 97:34 at Array. (/Users/exhumer/Projects/hello-electron/node_modules/we bpack/lib/cache/MemoryCachePlugin.js:45:13) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Cache.js: 97:19 at Hook.eval [as callAsync] (eval at create (/Users/exhumer/Projects/hello-e lectron/node_modules/tapable/lib/HookCodeFactory.js:33:10), :19:1) at Cache.get (/Users/exhumer/Projects/hello-electron/node_modules/webpack/li b/Cache.js:81:18) at ItemCacheFacade.get (/Users/exhumer/Projects/hello-electron/node_modules/ webpack/lib/CacheFacade.js:115:15) at Compilation._codeGenerationModule (/Users/exhumer/Projects/hello-electron /node_modules/webpack/lib/Compilation.js:3456:9) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Compilati on.js:3361:11 at arrayIterator (/Users/exhumer/Projects/hello-electron/node_modules/neo-as ync/async.js:3467:9) at timesSync (/Users/exhumer/Projects/hello-electron/node_modules/neo-async/ async.js:2297:7) group_0 (webpack 5.91.0) compiled with 1 error in 909 ms group_0: asset main_window/index.js 640 KiB [emitted] (name: main_window) asset main_window/index.html 262 bytes [emitted] runtime modules 26.3 KiB 13 modules modules by path ./node_modules/ 183 KiB modules by path ./node_modules/webpack-dev-server/client/ 71.8 KiB 16 modules modules by path ./node_modules/style-loader/dist/runtime/*.js 5.84 KiB 6 modules modules by path ./node_modules/webpack/hot/*.js 5.18 KiB 4 modules modules by path ./node_modules/html-entities/lib/*.js 78.9 KiB 4 modules modules by path ./node_modules/css-loader/dist/runtime/*.js 2.74 KiB ./node_modules/css-loader/dist/runtime/sourceMaps.js 505 bytes [built] [code generated] ./node_modules/css-loader/dist/runtime/api.js 2.25 KiB [built] [code generated] ./node_modules/ansi-html-community/index.js 4.16 KiB [built] [code generated] ./node_modules/events/events.js 14.5 KiB [built] [code generated] modules by path ./src/ 4.16 KiB ./src/renderer.ts 1.01 KiB [built] [code generated] ./src/index.css 2.24 KiB [built] [code generated] ./node_modules/css-loader/dist/cjs.js!./src/index.css 929 bytes [built] [code generated] ERROR in webpack/runtime/compat The installed version of @vercel/webpack-asset-relocator-loader does not appear to be compatible with Forge Error: The installed version of @vercel/webpack-asset-relocator-loader does not appear to be compatible with Forge at tapInfo.fn (/Users/exhumer/Projects/hello-electron/node_modules/@electron -forge/plugin-webpack/src/util/AssetRelocatorPatch.ts:45:23) at Hook.eval (eval at create (/Users/exhumer/Projects/hello-electron/node_mo dules/tapable/lib/HookCodeFactory.js:19:10), :9:16) at CompatRuntimeModule.generate (/Users/exhumer/Projects/hello-electron/node _modules/webpack/lib/runtime/CompatRuntimeModule.js:46:66) at CompatRuntimeModule.getGeneratedCode (/Users/exhumer/Projects/hello-elect ron/node_modules/webpack/lib/RuntimeModule.js:184:44) at CompatRuntimeModule.codeGeneration (/Users/exhumer/Projects/hello-electro n/node_modules/webpack/lib/RuntimeModule.js:139:30) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Compilati on.js:3463:22 at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Cache.js: 97:34 at Array. (/Users/exhumer/Projects/hello-electron/node_modules/we bpack/lib/cache/MemoryCachePlugin.js:45:13) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Cache.js: 97:19 at Hook.eval [as callAsync] (eval at create (/Users/exhumer/Projects/hello-e lectron/node_modules/tapable/lib/HookCodeFactory.js:33:10), :19:1) at Cache.get (/Users/exhumer/Projects/hello-electron/node_modules/webpack/li b/Cache.js:81:18) at ItemCacheFacade.get (/Users/exhumer/Projects/hello-electron/node_modules/ webpack/lib/CacheFacade.js:115:15) at Compilation._codeGenerationModule (/Users/exhumer/Projects/hello-electron /node_modules/webpack/lib/Compilation.js:3456:9) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Compilati on.js:3361:11 at arrayIterator (/Users/exhumer/Projects/hello-electron/node_modules/neo-as ync/async.js:3467:9) at timesSync (/Users/exhumer/Projects/hello-electron/node_modules/neo-async/ async.js:2297:7) group_0 (webpack 5.91.0) compiled with 1 error in 939 ms [ForkTsCheckerWebpackPlugin] Type-checking in progress... An unhandled rejection has occurred inside Forge: Error: Compilation errors in the preload: group_0: asset main_window/preload.js 553 KiB [emitted] (name: main_window) runtime modules 26.3 KiB 12 modules modules by path ./node_modules/ 160 KiB modules by path ./node_modules/webpack-dev-server/client/ 71.8 KiB 16 modules modules by path ./node_modules/webpack/hot/*.js 5.18 KiB ./node_modules/webpack/hot/dev-server.js 1.94 KiB [built] [code generated] ./node_modules/webpack/hot/log.js 1.74 KiB [built] [code generated] + 2 modules modules by path ./node_modules/html-entities/lib/*.js 78.9 KiB ./node_modules/html-entities/lib/index.js 4.84 KiB [built] [code generated] ./node_modules/html-entities/lib/named-references.js 73.1 KiB [built] [code generated] ./node_modules/html-entities/lib/numeric-unicode-map.js 389 bytes [built] [code generated] ./node_modules/html-entities/lib/surrogate-pairs.js 583 bytes [built] [code generated] ./node_modules/ansi-html-community/index.js 4.16 KiB [built] [code generated] ./src/preload.ts 158 bytes [built] [code generated] external "events" 42 bytes [built] [code generated] ERROR in webpack/runtime/compat The installed version of @vercel/webpack-asset-relocator-loader does not appear to be compatible with Forge Error: The installed version of @vercel/webpack-asset-relocator-loader does not appear to be compatible with Forge at tapInfo.fn (/Users/exhumer/Projects/hello-electron/node_modules/@electron-forge/plugin-webpack/src/util/AssetRelocatorPatch.ts:45:23) at Hook.eval (eval at create (/Users/exhumer/Projects/hello-electron/node_modules/tapable/lib/HookCodeFactory.js:19:10), :9:16) at CompatRuntimeModule.generate (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/runtime/CompatRuntimeModule.js:46:66) at CompatRuntimeModule.getGeneratedCode (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/RuntimeModule.js:184:44) at CompatRuntimeModule.codeGeneration (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/RuntimeModule.js:139:30) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Compilation.js:3463:22 at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Cache.js:97:34 at Array. (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/cache/MemoryCachePlugin.js:45:13) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Cache.js:97:19 at Hook.eval [as callAsync] (eval at create (/Users/exhumer/Projects/hello-electron/node_modules/tapable/lib/HookCodeFactory.js:33:10), :19:1) at Cache.get (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Cache.js:81:18) at ItemCacheFacade.get (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/CacheFacade.js:115:15) at Compilation._codeGenerationModule (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Compilation.js:3456:9) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Compilation.js:3361:11 at arrayIterator (/Users/exhumer/Projects/hello-electron/node_modules/neo-async/async.js:3467:9) at timesSync (/Users/exhumer/Projects/hello-electron/node_modules/neo-async/async.js:2297:7) group_0 (webpack 5.91.0) compiled with 1 error in 909 ms group_0: asset main_window/index.js 640 KiB [emitted] (name: main_window) asset main_window/index.html 262 bytes [emitted] runtime modules 26.3 KiB 13 modules modules by path ./node_modules/ 183 KiB modules by path ./node_modules/webpack-dev-server/client/ 71.8 KiB 16 modules modules by path ./node_modules/style-loader/dist/runtime/*.js 5.84 KiB 6 modules modules by path ./node_modules/webpack/hot/*.js 5.18 KiB 4 modules modules by path ./node_modules/html-entities/lib/*.js 78.9 KiB 4 modules modules by path ./node_modules/css-loader/dist/runtime/*.js 2.74 KiB ./node_modules/css-loader/dist/runtime/sourceMaps.js 505 bytes [built] [code generated] ./node_modules/css-loader/dist/runtime/api.js 2.25 KiB [built] [code generated] ./node_modules/ansi-html-community/index.js 4.16 KiB [built] [code generated] ./node_modules/events/events.js 14.5 KiB [built] [code generated] modules by path ./src/ 4.16 KiB ./src/renderer.ts 1.01 KiB [built] [code generated] ./src/index.css 2.24 KiB [built] [code generated] ./node_modules/css-loader/dist/cjs.js!./src/index.css 929 bytes [built] [code generated] ERROR in webpack/runtime/compat The installed version of @vercel/webpack-asset-relocator-loader does not appear to be compatible with Forge Error: The installed version of @vercel/webpack-asset-relocator-loader does not appear to be compatible with Forge at tapInfo.fn (/Users/exhumer/Projects/hello-electron/node_modules/@electron-forge/plugin-webpack/src/util/AssetRelocatorPatch.ts:45:23) at Hook.eval (eval at create (/Users/exhumer/Projects/hello-electron/node_modules/tapable/lib/HookCodeFactory.js:19:10), :9:16) at CompatRuntimeModule.generate (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/runtime/CompatRuntimeModule.js:46:66) at CompatRuntimeModule.getGeneratedCode (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/RuntimeModule.js:184:44) at CompatRuntimeModule.codeGeneration (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/RuntimeModule.js:139:30) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Compilation.js:3463:22 at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Cache.js:97:34 at Array. (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/cache/MemoryCachePlugin.js:45:13) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Cache.js:97:19 at Hook.eval [as callAsync] (eval at create (/Users/exhumer/Projects/hello-electron/node_modules/tapable/lib/HookCodeFactory.js:33:10), :19:1) at Cache.get (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Cache.js:81:18) at ItemCacheFacade.get (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/CacheFacade.js:115:15) at Compilation._codeGenerationModule (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Compilation.js:3456:9) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Compilation.js:3361:11 at arrayIterator (/Users/exhumer/Projects/hello-electron/node_modules/neo-async/async.js:3467:9) at timesSync (/Users/exhumer/Projects/hello-electron/node_modules/neo-async/async.js:2297:7) group_0 (webpack 5.91.0) compiled with 1 error in 939 ms at /Users/exhumer/Projects/hello-electron/node_modules/@electron-forge/plugin-webpack/src/WebpackPlugin.ts:528:27 at Hook.eval (eval at create (/Users/exhumer/Projects/hello-electron/node_modules/tapable/lib/HookCodeFactory.js:19:10), :7:1) at Hook.CALL_DELEGATE [as _call] (/Users/exhumer/Projects/hello-electron/node_modules/tapable/lib/Hook.js:14:14) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/MultiCompiler.js:100:22 at Hook.eval [as callAsync] (eval at create (/Users/exhumer/Projects/hello-electron/node_modules/tapable/lib/HookCodeFactory.js:33:10), :29:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/exhumer/Projects/hello-electron/node_modules/tapable/lib/Hook.js:18:14) at Watching._done (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Watching.js:309:28) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Watching.js:224:21 at Compiler.emitRecords (/Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Compiler.js:1028:5) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Watching.js:200:22 at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Compiler.js:990:14 at Hook.eval [as callAsync] (eval at create (/Users/exhumer/Projects/hello-electron/node_modules/tapable/lib/HookCodeFactory.js:33:10), :6:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/exhumer/Projects/hello-electron/node_modules/tapable/lib/Hook.js:18:14) at /Users/exhumer/Projects/hello-electron/node_modules/webpack/lib/Compiler.js:987:27 at /Users/exhumer/Projects/hello-electron/node_modules/neo-async/async.js:2818:7 at done (/Users/exhumer/Projects/hello-electron/node_modules/neo-async/async.js:3522:9) ➜ exhumer@EXHUMER-MACBOOK-AIR ~/Projects/hello-electron git:(main) ✗ Error: write EPIPE at target._send (node:internal/child_process:879:20) at target.send (node:internal/child_process:752:19) at /Users/exhumer/Projects/hello-electron/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/expose-rpc.js:27:31 at new Promise () at sendMessage (/Users/exhumer/Projects/hello-electron/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/expose-rpc.js:19:38) at /Users/exhumer/Projects/hello-electron/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/expose-rpc.js:60:27 at Generator.next () at fulfilled (/Users/exhumer/Projects/hello-electron/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/expose-rpc.js:5:58) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { errno: -32, code: 'EPIPE', syscall: 'write' } Error: write EPIPE at target._send (node:internal/child_process:879:20) at target.send (node:internal/child_process:752:19) at /Users/exhumer/Projects/hello-electron/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/expose-rpc.js:27:31 at new Promise () at sendMessage (/Users/exhumer/Projects/hello-electron/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/expose-rpc.js:19:38) at /Users/exhumer/Projects/hello-electron/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/expose-rpc.js:60:27 at Generator.next () at fulfilled (/Users/exhumer/Projects/hello-electron/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/expose-rpc.js:5:58) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { errno: -32, code: 'EPIPE', syscall: 'write' } ```

Steps to reproduce

npm create electron-app hello-electron -- --template=webpack-typescript
cd hello-electron
npm upgrade
npm start

Additional information

@vercel/webpack-asset-relocator-loader recently released a version 1.7.4. The package is added to a clean build of electron-forge with @vercel/webpack-asset-relocator-loader@^1.7.3. Running npm upgrade will cause this issue to appear. I modified by package.json to modify the the dependency to remove ^ and rerunning npm upgrade, locking it to 1.7.3, which seems to fix the issue for now.

robertomsen commented 6 months ago

Four days ago (as of May 20, 2024), version 1.7.4 of the @vercel/webpack-asset-relocator-loader package was released

At the moment it is not compatible, so if you get this error, go to the package.json, and in the dependencies look for this:

@vercel/webpack-asset-relocator-loader@^1.7.3 remove the hat so that it looks like this:

@vercel/webpack-asset-relocator-loader@1.7.3

And remove node_modules folder and reinstall with npm install / yarn or similar. This is a temporary solution until a new version is released.

All the best!

VerteDinde commented 6 months ago

Hey @eXhumer and @robertomsen, thanks for the reports here! This is definitely related to a PR landing upstream in the webpack-asset-relocator-loader module (specifically this one: https://github.com/vercel/webpack-asset-relocator-loader/pull/185). We'll get this fixed

uncaught commented 6 months ago

Did @vercel/webpack-asset-relocator-loader introduce a breaking change in a patch version there? Maybe ask them nicely to not do that in the future 🤔

hirbod-codes commented 5 months ago

changing ^1.7.3 to 1.7.3 in package.json for "@vercel/webpack-asset-relocator-loader" dependency fixed the issue for me

nikwen commented 4 months ago

Did @vercel/webpack-asset-relocator-loader introduce a breaking change in a patch version there?

@uncaught Forge currently currently relies on a specific version of that package being installed. Here's the explanation from the docs:

Electron Forge monkeypatches the asset relocator loader in order for it to work with Electron properly, so the version has been pinned to ensure compatibility. If you upgrade that version, you do so at your own risk.