This PR fixes the production build, which is currently broken in the main branch.
It removes the use of npx and instead runs the package bins directly using UtilityProcess to fork a process.
Since many things down the line make use of node and npm globally (postinstall scripts, esbuild, etc) it also links the node and npm bins to the forked process's $PATH.
The npm bin is linked to the one in the app's own node_modules.
For node what this does is create a symlink (or a cmd in windows) in the app's path (app.getAppPath) called node that points to electron's own process.execPath, and then it adds the app's path to the forked process's $PATH.
This approach works but may cause permissions issues on windows, we might need to use a different path other than the app's path to store the symlink to the node binaries.
This PR fixes the production build, which is currently broken in the main branch.
It removes the use of
npx
and instead runs the package bins directly usingUtilityProcess
to fork a process.Since many things down the line make use of
node
andnpm
globally (postinstall scripts, esbuild, etc) it also links thenode
andnpm
bins to the forked process's$PATH
.The
npm
bin is linked to the one in the app's ownnode_modules
.For
node
what this does is create a symlink (or a cmd in windows) in the app's path (app.getAppPath
) callednode
that points to electron's ownprocess.execPath
, and then it adds the app's path to the forked process's$PATH
.This approach works but may cause permissions issues on windows, we might need to use a different path other than the app's path to store the symlink to the
node
binaries.