-
-
Notifications
You must be signed in to change notification settings - Fork 58
Description
What version of pkg are you using?
6.12.0
What version of Node.js are you using?
20.20.0
What operating system are you using?
Ubuntu
What CPU architecture are you using?
x86
What Node versions, OSs and CPU architectures are you building for?
node18
Describe the Bug
We use PKG to create an executable that runs as a systemd service. We have recently switched from the original PKG to your fork and discovered that the app would fail to open due to the native module cache directory not existing and not having permission to create it ( the service user does not have a home directory ).
We have worked around this by defining PKG_NATIVE_CACHE_PATH in the service declaration but the executable is sometimes executed outside of the service with the same user, which now requires the ENV to be set. This isn't ideal. Being able to customise the location at build time would resolve this issue. But alternatively having a location not tied to the user for the cache as a fallback in the startup code would work.
Expected Behavior
Be able to run the executable even as a user without a home directory.
To Reproduce
- Create a user without a home directory
- Try and run any executable with that user
- Observe error
pkg/prelude/bootstrap.js:1867
throw error;
^
Error: EACCES: permission denied, mkdir '/home/$USER/.cache/pkg/c9bd0419f77efb3b5d3a691fda04e265f740ad8dc195f0b56003cdeac92e9a34'