There is currently no method of specifying that `npm` should not be installed along with `node`, it is always installed. npm is a particularly heavy library, it is bundled with a number of common dependencies that are installed globally (which may be undesired), including libraries that I maintain myself (specifically, this interferes with package.provided and portage overlays). It appears that the net-libs/npm package was removed as a result of Bug #410167, however a better course of action might be to simply add --without-npm to the configure call. Alternatively, enabling via a USE flag may also be appropriate. Reproducible: Always
As far as I know, npm has been installed since, well, ages ago: # equery files nodejs | grep bin/npm /usr/bin/npm /usr/lib/node_modules/npm/bin/npm /usr/lib/node_modules/npm/bin/npm-cli.js /usr/lib/node_modules/npm/bin/npm.cmd If I'm missing something, let me know; otherwise I'm keen to close as invalid.
Right, that's the problem: The option to enable/disable it isn't exposed as I pointed out. That is, there needs to be way to pass --without-npm.
(In reply to Austin Wright from comment #2) > Right, that's the problem: The option to enable/disable it isn't exposed as > I pointed out. > > That is, there needs to be way to pass --without-npm. Oh, didn't realise you wanted to disable this - sorry. I guess it wouldn't really be a problem to expose it through a use flag (which would default to on). Care to pass a patch? Also, out of curiosity - what's your use case? (I assume you want to handle npm install yourself?)
Created attachment 352352 [details, diff] Add an "npm" USE flag to net-libs/nodejs
Yeah sorry, I somewhat a misleading title. Ideally, npm would be distributed as a separate package -- other platforms like dev-ruby/rubygems for Ruby and dev-python/pip for Python follow this convention. (Not all packages do, Perl ships with cpan, though Gentoo's perl I think is unique in numerous ways.) Patching the ebuild to honor an "npm" USE flag also works, I attached a patch to do this which works against the current =net-libs/nodejs-0.11.2 and the new version 0.11.3. Both these suggestions, when by themselves, would have the effect of removing npm from the system during a routine update. Some work-arounds are (1) split the package in two and indicate it has forked (perhaps do a "move net-libs/nodejs net-libs/npm" and let nodejs get pulled in as a dependency), (2) add npm as a default USE flag to profiles (3) make the USE flag itself "without-npm", (4) publish a news item. In my experience, Gentoo historically seems to favor (4) news items. This would be useful in a number of ways, most significantly is that npm is a rather weighty package that simply not need be installed on many systems, I think it installs more total files than everything else. Many of these files are Node.js modules installed to the system library path -- creating conflicts if something is already installed there.
Created attachment 352370 [details, diff] Add IUSE="+npm" to net-libs/nodejs
Created attachment 352372 [details, diff] Add IUSE="+npm" to net-libs/nodejs
Actually, I forgot about the +flag syntax, I have't used that in quite a while. This patch seems to work on all my systems, with and without npm, various overlays, and (as if it matters) x86, amd64, and arm (I only see issues related to using system V8 now.)
Created attachment 352420 [details, diff] Add IUSE="+npm ssl" to net-libs/nodejs This version also adds support for the "ssl" USE flag. Currently, however, Node.js chokes on this flag.
Created attachment 353614 [details, diff] node-optional-npm.patch Here's a slightly simplified patch. Sorry for the delay, I've been travelling for a while. I'll try and get this in for the next release. I'll keep off the SSL stuff for now. I recall seeing the nodejs standard library not being to happy about disabling it. Lets revisit some other time.
That was just fixed, or at least since I wrote the patch, I believe the fix is now in v0.11.4: https://github.com/joyent/node/issues/5807 I haven't tried it yet though.
(In reply to Austin Wright from comment #11) > That was just fixed, or at least since I wrote the patch, I believe the fix > is now in v0.11.4: https://github.com/joyent/node/issues/5807 > > I haven't tried it yet though. Yeah, that's one of the issues I've been watching. Other one's I've had by using npm packages that just assumes its always available. Not saying that we shouldn't expose a choice - but if it blows up most of the time it's just annoying. Lets 0.11 roll on for a while and see if we can land it for 0.12! Thanks for the feedback.
(see bug #477348 for new ebuilds)
+ 19 Jul 2013; Patrick Lauer <patrick@gentoo.org> +nodejs-0.10.13.ebuild, + +nodejs-0.11.4.ebuild, metadata.xml: + Bump for #477348 with jbergstroem's patches for #475354