Multiple npm link in one project

2.7k views Asked by At

i'm struggling to use npm link. in fact i have two local packages that i would like to use in my project.

on each of the packages I performed the sudo npm link command. when I do an npm -g list I can therefore see these packages and their reference.

When I make an npm link <my-package-1> in my project, this add a symbolic link of my first package in node_modules. So far, so good.

Only when I make an npm link <my-package-2> in my project. npm first removes the symbolic link from my first package in node_modules and after he create a symbolic link to the second package in node_modules. I don't know why but I can't have more than one package with the link in my project.

Also when I do an ls of my node_modules folder, I see that the symbolic link is directed to my package folder and not to the node_modules folder of my global npm.

Am I missing something? I thought that was exactly what made an npm link different from an npm i ../path/to/my/package.

Thank you and good day

1

There are 1 answers

1
lhapaipai On BEST ANSWER

Finally, I solved my issue with

npm link <my-package-1> <my-package-2>

But the symbolic link is directed to my package folder and not to the node_modules folder of my global npm.