electron-vite / vite-plugin-electron

:electron: Electron⚡️Vite core repo
https://github.com/electron-vite
MIT License
691 stars 56 forks source link

Could not resolve dependency with Electorn #219

Closed major697 closed 8 months ago

major697 commented 8 months ago

vite-plugin-electron in version v0.28.2, not working with electron in version v29.0.1:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: vite-plugin-electron@0.28.2
npm ERR! Found: electron@29.0.1
npm ERR! node_modules/electron
npm ERR!   dev electron@"^29.0.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional electron@"^28.0.0" from vite-plugin-electron@0.28.2
npm ERR! node_modules/vite-plugin-electron
npm ERR!   dev vite-plugin-electron@"^0.28.2" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: electron@28.2.4
npm ERR! node_modules/electron
npm ERR!   peerOptional electron@"^28.0.0" from vite-plugin-electron@0.28.2
npm ERR!   node_modules/vite-plugin-electron
npm ERR!     dev vite-plugin-electron@"^0.28.2" from the root project

In package.json in vite-plugin-electron library should be version of Electron: v29.x.x:

RalfKronemeyer commented 8 months ago

have same issue

subframe7536 commented 8 months ago

you can suppress this error by setting overrides or pnpm.overrides in package.json

{
  "overrides": {
    "vite-plugin-electron": {
      "electron": "29.0.1"
    }
  }
}
alfreddagenais commented 8 months ago

Thank you @subframe7536 for me i just added :

"overrides": {
    "vite-plugin-electron": {
      "electron": "$electron"
    }
  }

Because $electron was already declared into my project 😄 More details