1

My Electron app uses a nodejs dependency (in my case it's mysqljs) and it works fine when running on development mode.

However when I build it and launch as a native desktop app, it fails with:

Electron ERROR Error: Cannot find module 'mysql' Require stack: ...

Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252

1 Answers1

1

The problem was that I accidentally placed mysql between the devDependencies of my package.json file.

It should instead be placed within the dependencies since it is supposed to be shipped with the app.

Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252