-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] npm link removes other links #3745
Comments
This works: $ npm link @myscope/package1 @myscope/package2
$ ll node_modules/@myscope
total 0
lrwxrwxrwx 1 Gopi 123 32 Sep 13 10:35 package1 -> /d/Projects/Websites/package1/
lrwxrwxrwx 1 Gopi 123 0 Sep 10 12:09 package2 -> /d/Projects/Websites/package2/
drwxr-xr-x 1 Gopi 123 0 Sep 13 10:35 package3/ Is the new behaviour intentional? I surely remember multiple links working in previous versions of npm. Although I have only attempted it on a posix env. |
This has been an issue for forever. I've reported this before (but probably those are lost in archived repos or forums). |
Just ran into this as well after upgrading to npm 7.x. I used to run a script to link 10+ dependencies like
@Gopikrishna19 thanks for the suggestion |
40829ec should have fixed this. What does the error state look like now in windows? |
will test it now @wraithgar |
Its still not working in Windows: D:\Projects\test> md app1 ; cd app1 ; npm init -y ; npm link ; cd ..
D:\Projects\test> md app2 ; cd app2 ; npm init -y ; npm link ; cd ..
D:\Projects> md app3 ; cd app3 ; npm init -y
D:\Projects\app3> npm link app1
D:\Projects\app3> npm link app2
D:\Projects\app3> ls node_modules
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----l 3/17/2022 3:20 PM app2
-a---- 3/17/2022 3:20 PM 366 .package-lock.json Again, as mentioned a combined link works. D:\Projects\app3> npm link app1 app2
D:\Projects\app3> ls node_modules
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----l 3/17/2022 3:18 PM app1
d----l 3/17/2022 3:18 PM app2
-a---- 3/17/2022 3:18 PM 387 .package-lock.json However, something did change. If I link both deps and link one again, it is not unlinking others anymore: D:\Projects\app3> npm link app1 app2
D:\Projects\app3> npm link app2
D:\Projects\app3> ls node_modules
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----l 3/17/2022 3:18 PM app1 # Still available
d----l 3/17/2022 3:18 PM app2
-a---- 3/17/2022 3:18 PM 387 .package-lock.json |
Works in mac though: ~/Developer/npm-test
❯ mkdir app1 && cd app1 && npm init -y && npm link && cd ..
❯ mkdir app2 && cd app2 && npm init -y && npm link && cd ..
❯ mkdir app3 && cd app3 && npm init -y
~/Developer/npm-test/app3
❯ npm link app1
❯ npm link app2
~/Developer/npm-test/app3
❯ ll node_modules
total 8
drwxr-xr-x 5 Gopi 123 160 Mar 17 15:26 .
drwxr-xr-x 4 Gopi 123 128 Mar 17 15:26 ..
-rw-r--r-- 1 Gopi 123 403 Mar 17 15:26 .package-lock.json
lrwxr-xr-x 1 Gopi 123 10 Mar 17 15:26 app1 -> ../../app1
lrwxr-xr-x 1 Gopi 123 10 Mar 17 15:26 app2 -> ../../app2
|
Versions: ~/Developer/npm-test/app3
❯ npm --version
8.5.5
❯ node --version
v16.14.1 D:\Projects\app3> npm --version
8.5.4
D:\Projects\app3> node --version
v16.14.1 I guess I missed the v8.5.5, released 2 hours ago, on Windows. Your comment about the fix was from yesterday, so I guess v8.5.4 is still valid. Please let me know if you want me to test with 8.5.5 on Windows. |
No, there were no changes in 8.5.5 that would be relevant to this bug. |
@Gopikrishna19 can you please retest this in windows and confirm if issue is till there. |
Hi ! Having this issue right now (WSL2 / Ubuntu). Figured that I had to npm link moduleA moduleB to have them since, since linking moduleA unlinks moduleB. Or is it the expected behaviour? |
bump, encountered same issue Ubuntu 22, node v20.12.1, npm 10.5.0 |
Is there an existing issue for this?
Current Behavior
Linking package1
$ npm link @myscope/package1 changed 1 package, and audited 603 packages in 10s found 0 vulnerabilities
$ ll node_modules/@myscope total 0 lrwxrwxrwx 1 Gopi 123 32 Sep 13 10:35 package1 -> /d/Projects/Websites/package1/ drwxr-xr-x 1 Gopi 123 0 Sep 10 12:09 package2/ drwxr-xr-x 1 Gopi 123 0 Sep 13 10:35 package3/
Linking package2
$ npm link @myscope/package2 changed 2 packages, and audited 603 packages in 10s found 0 vulnerabilities
$ ll node_modules/@myscope total 0 drwxr-xr-x 1 Gopi 123 32 Sep 13 10:35 package1/ lrwxrwxrwx 1 Gopi 123 0 Sep 10 12:09 package2 -> /d/Projects/Websites/package2/ drwxr-xr-x 1 Gopi 123 0 Sep 13 10:35 package3/
Expected Behavior
Linking package1
$ npm link @myscope/package1 changed 1 package, and audited 603 packages in 10s found 0 vulnerabilities
$ ll node_modules/@myscope total 0 lrwxrwxrwx 1 Gopi 123 32 Sep 13 10:35 package1 -> /d/Projects/Websites/package1/ drwxr-xr-x 1 Gopi 123 0 Sep 10 12:09 package2/ drwxr-xr-x 1 Gopi 123 0 Sep 13 10:35 package3/
Linking package2
$ npm link @myscope/package2 changed 1 package, and audited 603 packages in 10s found 0 vulnerabilities
Steps To Reproduce
Environment
The text was updated successfully, but these errors were encountered: