Skip to content
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

Fails to start if $HOME is not set (which happens if run under upstart) #51

Open
PAStheLoD opened this issue Sep 10, 2015 · 7 comments
Open

Comments

@PAStheLoD
Copy link

In config.js path.normalize gets an undefined and the program aborts if HOME is not set.

@jpaulin
Copy link

jpaulin commented Jan 20, 2016

Is this still the case?

@PAStheLoD
Copy link
Author

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.

@jpaulin
Copy link

jpaulin commented Jan 20, 2016

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 :-)

@PAStheLoD
Copy link
Author

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 :)

@mixu
Copy link
Owner

mixu commented Jan 21, 2016

Happy to accept a PR to make this better - perhaps via https://www.npmjs.com/package/home-path ?

@jpaulin
Copy link

jpaulin commented Jan 22, 2016

Interesting idea! Let's see what's coming up from the cauldron. :-)

@framp
Copy link

framp commented Mar 14, 2016

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants