You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building a web app inside a container, the $HOME variable is not set. NPM tries to write to the non-existent directory, and you get a EACCES: permission denied, mkdir '/homeless-shelter' error.
app=nl2nix.v2.build{src=./.;nodejs=pkgs.nodejs-18_x;buildCommands=["npm run build"];};
Example logs:
trace: warning: [npmlock2nix] You are using the new v2 beta api. The interface isn't stable yet. Please report any issues at https://github.com/nix-community/npmlock2nix/issues
these 4 derivations will be built:
/nix/store/bqmd5qx140xxbr4j02y07k54ri2i8743-app-nodejs-0.1.0.drv
/nix/store/7pd87dr33nncigdm5gk83sjzd81qipmd-docker-layer-app.drv
/nix/store/qgq0pmkdgpi65ngijx4cvxmwh79cwpsb-runtime-deps.drv
/nix/store/cx930cb5wc2zy3rw8xgfzzm284m38y8p-docker-image-app.tar.gz.drv
building '/nix/store/bqmd5qx140xxbr4j02y07k54ri2i8743-app-nodejs-0.1.0.drv'...
app-nodejs> unpacking sources
app-nodejs> unpacking source archive /nix/store/j0ll9ipg4ipyyd4fcdrwyj3y8wdnnwbh-bnfw680ps3kma0rsx19a5n1qyb1qyv5k-source
app-nodejs> source root is bnfw680ps3kma0rsx19a5n1qyb1qyv5k-source
app-nodejs> patching sources
app-nodejs> configuring
app-nodejs> no configure script, doing nothing
app-nodejs> building
app-nodejs> npm verb cli /nix/store/mdgmqgbiqw30lygdn6q5pd6cvx4ialvb-nodejs-18.16.1/bin/node /nix/store/mdgmqgbiqw30lygdn6q5pd6cvx4ialvb-nodejs-18.16.1/bin/npm
app-nodejs> npm info using [email protected]
app-nodejs> npm info using [email protected]
app-nodejs> npm verb cache could not create cache: Error: EACCES: permission denied, mkdir '/homeless-shelter'
app-nodejs> npm verb logfile could not create logs-dir: Error: EACCES: permission denied, mkdir '/homeless-shelter'
app-nodejs> npm verb title npm run build
app-nodejs> npm verb argv "run" "build" "--loglevel" "verbose"
app-nodejs> npm verb logfile logs-max:10 dir:/homeless-shelter/.npm/_logs/2023-07-19T12_15_14_436Z-
app-nodejs> npm verb logfile could not be created: Error: ENOENT: no such file or directory, open '/homeless-shelter/.npm/_logs/2023-07-19T12_15_14_436Z-debug-0.log'
app-nodejs> npm verb logfile no logfile created
app-nodejs>
Workaround
A workaround is to customise the buildCommands to set the $HOME directory as part of the build process.
app=nl2nix.v2.build{src=./.;nodejs=pkgs.nodejs-18_x;buildCommands=["HOME=$PWD""npm run build"];};
Possible solution
If HOME is set to something that's not writable, set a sensible default automatically?
The text was updated successfully, but these errors were encountered:
When building a web app inside a container, the $HOME variable is not set. NPM tries to write to the non-existent directory, and you get a
EACCES: permission denied, mkdir '/homeless-shelter'
error.Example logs:
Workaround
A workaround is to customise the
buildCommands
to set the $HOME directory as part of the build process.Possible solution
If
HOME
is set to something that's not writable, set a sensible default automatically?The text was updated successfully, but these errors were encountered: