Skip to content

--force flag doesn't work with Vite template #3783

Closed
@erickzhao

Description

Pre-flight checklist

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

Electron Forge version

7.6.0

Electron version

33.0.0

Operating system

macOS 14.7.1

Last known working Electron Forge version

No response

Expected behavior

See the webpack plugin's behaviour for expected behaviour:

npx create-electron-app@latest my-vue-app --template=webpack --force
✔ Locating custom template: "webpack"
✔ Initializing directory
  › ⚠ The specified path "/Users/erick.zhao/Developer/dump/my-vue-app" is not empty. "force" was set to true, so
    proceeding to initialize. Files may be overwritten
✔ Preparing template
✔ Initializing template
✔ Installing template dependencies

Actual behavior

npx create-electron-app@latest my-vue-app --template=vite --force
✔ Locating custom template: "vite"
✔ Initializing directory
  › ⚠ The specified path "/Users/erick.zhao/Developer/dump/my-vue-app" is not empty. "force" was set to true, so
    proceeding to initialize. Files may be overwritten
✔ Preparing template
❯ Initializing template
  ✔ Copying starter files
  ✔ Initializing package.json
  ✔ Setting up Forge configuration
  ✖ dest already exists.
◼ Installing template dependencies

An unhandled rejection has occurred inside Forge:
Error: dest already exists.
at doRename (/Users/erick.zhao/.npm/_npx/35c48adf706267bc/node_modules/fs-extra/lib/move/move-sync.js:32:34)
    at Object.moveSync (/Users/erick.zhao/.npm/_npx/35c48adf706267bc/node_modules/fs-extra/lib/move/move-sync.js:17:10)
    at _Task.task [as taskFn] (/Users/erick.zhao/.npm/_npx/35c48adf706267bc/node_modules/@electron-forge/template-vite/dist/ViteTemplate.js:43:40)
    at async _Task.run (/Users/erick.zhao/.npm/_npx/35c48adf706267bc/node_modules/listr2/dist/index.cjs:2063:11)

Steps to reproduce

Run create-electron-app with the --force flag and --template=vite

Additional information

No response

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions