Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 475354 - net-libs/nodejs: add IUSE=npm
Summary: net-libs/nodejs: add IUSE=npm
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Johan Bergström
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-30 18:43 UTC by Austin Wright
Modified: 2013-07-19 06:52 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Add an "npm" USE flag to net-libs/nodejs (nodejs-0.11.2.ebuild.patch,884 bytes, patch)
2013-06-30 23:48 UTC, Austin Wright
Details | Diff
Add IUSE="+npm" to net-libs/nodejs (nodejs-0.11.2.ebuild.patch,1008 bytes, patch)
2013-07-01 07:29 UTC, Austin Wright
Details | Diff
Add IUSE="+npm" to net-libs/nodejs (nodejs-0.11.2.ebuild.patch,1.04 KB, patch)
2013-07-01 07:40 UTC, Austin Wright
Details | Diff
Add IUSE="+npm ssl" to net-libs/nodejs (nodejs-0.11.2.ebuild.patch,1.09 KB, patch)
2013-07-01 19:30 UTC, Austin Wright
Details | Diff
node-optional-npm.patch (node-optional-npm.patch,958 bytes, patch)
2013-07-19 03:08 UTC, Johan Bergström
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Austin Wright 2013-06-30 18:43:19 UTC
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
Comment 1 Johan Bergström 2013-06-30 22:52:04 UTC
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.
Comment 2 Austin Wright 2013-06-30 22:55:25 UTC
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.
Comment 3 Johan Bergström 2013-06-30 22:58:32 UTC
(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?)
Comment 4 Austin Wright 2013-06-30 23:48:13 UTC
Created attachment 352352 [details, diff]
Add an "npm" USE flag to net-libs/nodejs
Comment 5 Austin Wright 2013-07-01 00:16:28 UTC
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.
Comment 6 Austin Wright 2013-07-01 07:29:09 UTC
Created attachment 352370 [details, diff]
Add IUSE="+npm" to net-libs/nodejs
Comment 7 Austin Wright 2013-07-01 07:40:24 UTC
Created attachment 352372 [details, diff]
Add IUSE="+npm" to net-libs/nodejs
Comment 8 Austin Wright 2013-07-01 07:57:21 UTC
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.)
Comment 9 Austin Wright 2013-07-01 19:30:32 UTC
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.
Comment 10 Johan Bergström 2013-07-19 03:08:16 UTC
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.
Comment 11 Austin Wright 2013-07-19 03:11:40 UTC
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.
Comment 12 Johan Bergström 2013-07-19 03:14:34 UTC
(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.
Comment 13 Johan Bergström 2013-07-19 03:18:31 UTC
(see bug #477348 for new ebuilds)
Comment 14 Patrick Lauer gentoo-dev 2013-07-19 06:52:52 UTC
+  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