-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Process created using pkg returns the wrong path #30
Comments
This was referenced Sep 1, 2022
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The module doesn't return the correct path when running as a self-executable process (not directly using node).
This happens due to the usage of
process.execPath
which is assumed to returnnode
/node.exe
but that isn't always the case.Steps to reproduce:
pkg
globally:npm i -g pkg
global-prefix
locallymyApp.js
, type inconsole.log(require('global-prefix'))
node index.js
-> You get something like/usr/bin/
or/Users/MY_USERNAME/.nvm/versions/node/v14.20.0
pkg myApp.js -t linux
/pkg myApp.js -t macos
/ whatever..myApp
/myApp.exe
-> Unexepected result, something like:C:\Users\myApp.exe
. The expected result is the global directory where NodeJS sits.A proposed solution would be to explicitly search for
node
executable (like this library does withnpm
) instead of usingprocess.execPath
.Pull Request
The text was updated successfully, but these errors were encountered: