forge icon indicating copy to clipboard operation
forge copied to clipboard

plugin-vite - Error: Cannot copy '../which/bin/node-which' to a subdirectory of itself, '../which/bin/node-which'.

Open gorillamoe opened this issue 1 year ago • 2 comments

Pre-flight checklist

  • [X] I have read the contribution documentation for this project.
  • [X] I agree to follow the code of conduct that this project uses.
  • [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

7.4.0

Electron version

v30.0.6

Operating system

Pop!_OS by System76 (Latest)

Last known working Electron Forge version

Bare version with just HTML and JS, e.g. No Vite + TS

Expected behavior

npm run make does not error out on Linux & Mac & Windows in CI with Vite + TS.

Actual behavior

npm run make DOES error out on Linux & Mac in CI.

Steps to reproduce

  1. git clone https://github.com/mistweaverco/timetrack && cd timetrack
  2. git checkout v3.3.0
  3. npm ci
  4. npm run make

Additional information

Seems to be due to a bug in fs-extra in the vite-plugin.

image

I patched it here for my project, but probably you guys and girls can also fork fs-extra and patch it and use your patched version of it?!

gorillamoe avatar May 19 '24 21:05 gorillamoe

我也碰到了一样的问题 我的系统是macOS

bi-migrate git:(main) ✗ DEBUG=electron-forge:* bun run make $ electron-forge make ✔ Checking your system

electron-forge:check-system checking system, create ~/.skip-forge-system-check to stop doing this +0ms ❯ Loading configuration electron-forge:project-resolver searching for project in: /Users/superman/studio/bi/bi-migrate +0ms electron-forge:project-resolver package.json with forge dependency found in /Users/superman/studio/bi/bi-migrate/package.json +5ms The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details. electron-forge:plugin:vite hooking process events +0ms ✔ Loading configuration ❯ Resolving make targets › Making for the following targets: ✔ Resolving make targets ❯ Running package command ❯ Preparing to package application electron-forge:project-resolver searching for project in: /Users/superman/studio/bi/bi-migrate +2s electron-forge:project-resolver package.json with forge dependency found in /Users/superman/studio/bi/bi-migrate/package.json +2ms electron-forge:plugin:vite hooking process events +29ms ✔ Preparing to package application ❯ Running packaging hooks ❯ Running generateAssets hook ✔ Running generateAssets hook ❯ Running prePackage hook ❯ [plugin-vite] Building vite bundles vite v5.3.4 building for production... vite v5.3.4 building for production... vite v5.3.4 building for production... ✓ 1 modules transformed. Generated an empty chunk: "preload". ✓ 1 modules transformed. .vite/build/preload.js 0.01 kB │ gzip: 0.03 kB ✓ built in 276ms .vite/build/main.js 0.62 kB │ gzip: 0.39 kB ✓ built in 278ms ✓ 3262 modules transformed. .vite/renderer/main_window/index.html 0.46 kB │ gzip: 0.32 kB .vite/renderer/main_window/assets/index-f0-SmT3O.css 3.33 kB │ gzip: 1.10 kB .vite/renderer/main_window/assets/index-Du7x4BzG.js 1,498.52 kB │ gzip: 457.28 kB

(!) Some chunks are larger than 500 kB after minification. Consider:

  • Using dynamic import() to code-split the application
  • Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
  • Adjust chunk size limit for this warning via build.chunkSizeWarningLimit. ✓ built in 11.92s ✔ [plugin-vite] Building vite bundles ✔ Running prePackage hook ✔ Running packaging hooks ❯ Packaging application › Determining targets... electron-forge:packager packaging with options { asar: true, overwrite: true, ignore: [Function (anonymous)], icon: 'assets/icons/app', quiet: true, dir: '/Users/superman/studio/bi/bi-migrate', arch: 'x64', platform: 'darwin', afterFinalizePackageTargets: [ [AsyncFunction (anonymous)] ], afterComplete: [ [AsyncFunction (anonymous)] ], afterCopy: [ [AsyncFunction (anonymous)] ], afterExtract: [ [AsyncFunction (anonymous)] ], afterPrune: [ [AsyncFunction (anonymous)] ], out: '/Users/superman/studio/bi/bi-migrate/out', electronVersion: '31.1.0' } +0ms electron-forge:packager targets: [ { platform: 'darwin', arch: 'x64' } ] +8ms ❯ Packaging for x64 on darwin ❯ Copying files ❯ Preparing native dependencies ❯ Finalizing package ✔ Copying files

An unhandled rejection has occurred inside Forge: Error: Cannot copy '../which/bin/which' to a subdirectory of itself, '../which/bin/which'. at /Users/superman/studio/bi/bi-migrate/node_modules/fs-extra/lib/copy/copy.js:213:21 at FSReqCallback.oncomplete (node:fs:200:23) electron-forge:plugin:vite handling process exit with: { cleanup: true } +27s electron-forge:plugin:vite handling process exit with: { cleanup: true } +1ms error: script "make" exited with code 1 ➜ bi-migrate git:(main) ✗

Superman-wc avatar Jul 17 '24 04:07 Superman-wc

使用旧版本 Electron Forge 7.3.0就可以正常执行

Superman-wc avatar Jul 17 '24 04:07 Superman-wc