Skip to content

npm link --save #1166

Open
isaacs opened this Issue Jul 20, 2011 · 20 comments
@isaacs
npm member
isaacs commented Jul 20, 2011

It'd be good to be able to --save a package when installing as a link.

Right now, this is sort of possible with npm install --link --save, but only if the package in question is already linked or installed globally.

@ralt
ralt commented Mar 12, 2013

@isaacs 2 years without any news. Sup?

@isaacs
npm member
isaacs commented Mar 13, 2013

Still not implemented, patch still welcome.

It's ok for feature requests to stay open forever. It'll be here when someone gets bored and decides to implement it.

@evanlucas

If the package is not already linked or installed globally how would this need to behave? Install it globally?

@reggi
reggi commented Jan 7, 2014

Point to the relative path specified and link it, that's my preference.

@mrjackdavis

bump; "Point to the relative path specified and link it, that's my preference."

@sonewman
sonewman commented Mar 3, 2014

this feature would be awesome and same goes for --save-dev

@othiym23 othiym23 added feature-request ready and removed bug labels Sep 20, 2014
@BrunoWinck

Banging on this so simple feature again.

I would keep the argument as it was given, If it's a global package, link will remain global as well. This allows packages to be portable. If packaged is not yet available it will fail which is fine.

I see it's flagged as ready :) cool how to get it ?

@sonewman
sonewman commented Dec 8, 2014

👍 definitely! it has been tagged as ready, has this been released @othiym23?

@jprichardson

Since my Dropbox is grinding to a halt with close to a million files, I've started linking to global packages. I was blown away that this wasn't implemented. This would be super cool :)

@othiym23

@sonewman ready means that it's ready for someone to start work on it, not that it's ready for release. This is one of those things that would best be supported by somebody who really needs it, because the CLI team is small and our backlog is very large.

@sonewman

@othiym23 ahh sorry my bad. I would like to say I will take a shot, but i have a busy schedule...
My guess is it would need to add to package.json here lib/link.js#L108 before resultPrinter.

Would it be done for all the "save" options?

@othiym23

@sonewman I think the only options it would make sense for are --save and --save-dev. --save-optional and --save-bundle seem fraught to me, although I could be persuaded. The other --save options are doing something semantically distinct (and should probably have different names, but that's neither here nor there).

@shaneparsons

I see this is closed, but what was the conclusion?

@reggi
reggi commented Jul 18, 2015

Just tried and still doesn't save :(

@othiym23

@shaneparsons / @reggie That's because it's not closed -- this is probably something that's going to need to come from the community, because the core team still doesn't have the cycles for something like this to bubble to the top of the priority list.

@joepie91
joepie91 commented Aug 9, 2015

Any estimate on how much work it would be to implement this, with no prior familiarity with the npm codebase? I'd like to have this feature as well, and if it wouldn't take too long to implement, I might try my hand at it some day soon.

@reggi
reggi commented Aug 12, 2015

I created modue-assign a different approach on module linking. It creates a package.json file inside node_modules with a main that references a specified file. In this way it doesn't use linking or symbolic linking. Everything gets saved to a localDependencies property in package.json. I'd appreciate any thoughts.

@littleguga

So, after four years it's unreal?

@reggi - it's awesome, but it would great to use it with npm, like
npm link --save-dev

@codekraft-studio

yes it will be awesome and also smart because every time you don't have to reinstall locally what you already have saved globally (es: grunt)

npm link grunt --save-dev
@othiym23 othiym23 removed the ready label Jan 29, 2016
@othiym23 othiym23 added the link label Apr 13, 2016
@othiym23 othiym23 added this to the understandable links milestone Apr 13, 2016
@othiym23

This is a reasonably small task, and also feels like the intuitively correct thing for the CLI to do in this case; we've created a new milestone to group together this and some of the other tasks related to working with linked packages. We should get to these sometime in 2016, but if you feel like taking a whack at them sooner, by all means, be our guest. Thanks for your patience, and thanks to @isaacs for capturing this idea in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.