4 ms·
> A specially named directory, node_modules/, is searched in the current directory for any modules. Awesome. Currently NPM expects unprivileged users to have
by nailer 16y ago
> A specially named directory, node_modules/, is searched in the current directory for any modules.
Awesome. Currently NPM expects unprivileged users to have
access to /usr/local, and a lot of node tutorials encourage global repermissioning of this directory, which is Bad Unix.
Hopefully, once NPM gets updated, you'll have a Python virtualenv/Ruby equivalent style project-specific install system.
Update:
https://github.com/isaacs/nave https://github.com/isaacs/nave says Nave provides virtualenvs for Node, which may be worth checking out.
- jdub 16y agonpm currently supports ~/.node_modules, by the way (which node has supported for ages)
- coenhyde 16y agoBut then you are still relying on modules available and their versions on the system where the node app is running. Bundling is a much more reliable way of doing things.
- jdub 16y agoBundling (and the like) is a necessary evil of ecosystems riding hard on the bleeding edge, like node.js... ... and I would say Ruby/Rails, but they ought to be growing up by now, and integrating sensibly with platform package management. :-) The difference between Python and Ruby on Debian/Ubuntu systems is astounding, and as the node.js ecosystem matures I dearly hope it will look more like the Python world than the unending adolescence of Ruby/Rails.
- mnutt 16y agoI don't think it's really fair to lay all of the blame with node and ruby/rails in this case; the distro package managers are just as much at fault: http://sheddingbikes.com/posts/1285063820.html http://sheddingbikes.com/posts/1285063820.html It really just depends on what you're trying to do. As a desktop user you probably care most about stability; we can't have a python upgrade breaking apt. As a developer it's often important to have an up-to-date version of the tools and libraries you're using.
- steveklabnik 16y ago> the unending adolescence It has nothing to do with adolescence, and everything to do with different priorities. Debian favors stability, Ruby favors breakneck progress. Each has their pros and cons.
- nailer 16y agoAwesome! Alas the doc I've been reading all points to the normal /usr/local method (eg, https://github.com/isaacs/npm/blob/master/doc/faq.md https://github.com/isaacs/npm/blob/master/doc/faq.md doesn't mention the new stuff). How can I make it use ~/.node_modules?
- hasenj 16y ago> Currently NPM expects unprivileged users to have access to /usr/local, and a lot of node tutorials encourage global repermissioning of this directory, which is Bad Unix NPM reminds you do "sudon't" if you run it as root. Configuring it to use ~/.node_modules is not very straight forward or obvious but once you do it everything would work with an unprivileged user and without messing up Unix.
- nailer 16y ago> NPM reminds you do "sudon't" if you run it as root. To install NPM itself, you either get a bunch of 'sudont' errors or have the app fail with the normal, secure /usr/local permissions when it can't write there. Try it.
- mnutt 16y agoI ran into this a few days ago. I ended up reinstalling node with a prefix of ~/local, and then when I built npm it automatically used the same prefix.
- ylem 16y agocan one do a chroot?