Fails to start if $HOME is not set (which happens if run under upstart)
Opened this issue · 7 comments
In config.js path.normalize gets an undefined and the program aborts if HOME is not set.
Is this still the case?
Haven't tried it since. I guess it's best to close this issue and if someone encounters it again they can just reopen it.
The logic goes like:
If we are running on win32, take USERPROFILE (environment variable)
otherwise take HOME.
If HOME unset, the expression evaluates to undefined.
What's the ballpark role of upstart Linux? Just out of curiosity :-)
Upstart is the user space process manager used by Ubuntu, it's the "init system", as it starts other user space stuff (udev, dhcpd, cron, wpa-supplicant, ssh, lightdm, which in turn start X and a desktop environment, such as KDE, GNOME, Xfce), and as the process with process id 1, it's responsible for reaping zombies. The usual stuff :)
Ubuntu is moving to systemd (new init system, big flame wars, all the fun you can imagine!), but I don't know whether $HOME will be defined there by default for services.
So, if npm_lazy hard-depends on HOME in the environment, then it should check for it and complain loudly if it cannot find it :)
Happy to accept a PR to make this better - perhaps via https://www.npmjs.com/package/home-path ?
Interesting idea! Let's see what's coming up from the cauldron. :-)
The same issue involves systemd.
[Unit]
Description=NPM Lazy Cache
Requires=network.target
After=network.target
[Service]
#Environment=HOME=/home/framp
ExecStart=/usr/bin/npm_lazy --config /etc/npm_lazy.config.js
Restart=always
[Install]
WantedBy=multi-user.target
A workaround is simply to set HOME
but the proper solution would be to fix config.js.
Maybe there is a way not to require HOME
? Maybe using cwd
if HOME
is not set?