volta icon indicating copy to clipboard operation
volta copied to clipboard

Allow use of `npm link ../relative-directory`

Open antony opened this issue 3 years ago • 2 comments

If you try to use modules from sibling directories to the current one, npm allows you to specify a relative path to create a link.

It appears that volta disallows this, and requires you to go into the other directory, link, and then npm link package-name in the current directory.

It's fairly inconvenient, but I think should be easy enough to fix since it's really just bundling two operations.

antony avatar Mar 05 '21 14:03 antony

Hi @antony, thanks for reporting this! That use-case definitely wasn't covered by our initial implementation. It's a bit tricky to implement as-is, due to how we handle the two link commands separately. However, one approach we could take would be to separate the two in the same way that npm link does: Run them as two commands effectively back-to-back: npm link (in the target directory) and then npm link <package name> in the current directory.

charlespierce avatar Mar 05 '21 20:03 charlespierce

As a workaround, I've been using a different npm. I'm on macOS using homebrew and running /opt/homebrew/bin/npm link.

~Why does Volta change how npm cli works, does it do more than install it?~ Conversation continued in: https://github.com/volta-cli/volta/issues/1001#issuecomment-1051404288

tim-phillips avatar Feb 25 '22 23:02 tim-phillips

It still doesn't work

Alnipet avatar Jul 26 '23 09:07 Alnipet