Explanation of -g vs npx
machineghost opened this issue · 0 comments
In general -g
(ie. global) Node packages are sort of considered an anti-pattern, and the "correct" way to run Node modules as apps is to install them locally and use npx
. I'm not at all saying Forever is wrong for installing globally, but it might be nice if the documentation addressed this somehow.
Obviously if you want to be able to start any arbitrary command using Forever, then the global installation has advantages, as you can run it anywhere. But for the fairly common use case of "I want to restart my Node web server" ... why shouldn't users keep their global environment as clean as possible? Is there any reason why they shouldn't avoid -g
and just call npx forever foo.js
?
Again, I'm not fishing for any specific answer to those questions, just trying to understand what I might be missing (eg. maybe things explode if I run the library with npx
?)