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

npm run make successfully,but reporting an error cannot find module 'electron-squirrel-startup' #203

Open
snowlotos opened this issue Nov 6, 2024 · 1 comment

Comments

@snowlotos
Copy link

snowlotos commented Nov 6, 2024

I use the Windows system to download the official template: 'npm init electron-app@latest My new app - template=vite typescript', and 'npm start' runs successfully. Execute 'npm run make' and successfully generate the exe installable file. However, when clicking on the .exe file to install, an error message appears saying 'cannot find module' electron squirrel startup ', which prevents the installation
I changed my Mac computer, downloaded the official template again and executed 'npm run make'. It was able to generate the. app file normally, but clicking on the file installation still reported the same error.
I deleted the node_comodules folder and 'npm install' again, but the problem still hasn't been resolved.
I executed 'npm uninstall electron squirrel startup' to delete the file, and then 'npm install electron squirrel startup -- save' separately, but still did not solve the problem
May I ask how I can solve this problem
问题1
问题2

@tanishqkancharla
Copy link

My guess: the Vite template is probably doing something like "require(electron-squirrel-startup)" and isn't bundling the module properly.

You can try importing the module instead:

import requiresStartup from "electron-squirrel-startup"

if(requiresStartup) app.quit()

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

2 participants