capacitor-community / electron

Deploy your Capacitor apps to Linux, Mac, and Windows desktops, with the Electron platform! 🖥️
https://capacitor-community.github.io/electron/
MIT License
342 stars 59 forks source link

Error: ENOENT: no such file or directory #296

Open edyth933 opened 2 months ago

edyth933 commented 2 months ago

When run npx cap add @capacitor-community/electron, an error occurs like this;

[Error: ENOENT: no such file or directory, stat '~/monorepo/packages/client/node_modules/@capacitor-community/electron/template.tar.gz''] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'stat',
  path: '~/monorepo/packages/client/node_modules/@capacitor-community/electron/template.tar.gz''
}

also these errors occur:

Unable to find node_modules/@vitejs/plugin-react-swc.
Are you sure @vitejs/plugin-react-swc is installed?
Unable to find node_modules/vite-plugin-top-level-await.
Are you sure vite-plugin-top-level-await is installed?

I am running this in ~/monorepo/packages/client, but the dependency packages is located in ~/monorepo/node_modules. I expect this should work like npx vite.

Ainias commented 1 month ago

I've had the same error. As a workaround, I added an old version to the root-package.json. Therefore it will be installed in the node_modules of the package itself and not the root node_modules. I use npm as package-manager. No idea if it works with other package-managers. But be aware, that this plugin here is expecting other packages to be installed on the monorepo/package-level and not the root level