-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 fails and deletes entire project #2104
Comments
i've not been able to reproduce this one, with your instructions i actually don't get any errors at all (when running my terminal as admin, without admin i get EPERM errors when it tries to create the symlinks which i think is expected though is also something we can fix) does this still happen for you with npm 7.0.7? |
I'm seeing the same behaviour in 7.0.7. My terminal is also running as elevated. I have no idea what's causing the |
I just had a similar problem where many files were deleted, and lost a couple of hours worth of work in my working copy. I ran The behaviour seemed to be consistent as I tried a couple of times. I got around the problem by reinstalling node.js through nvm-windows. |
do you happen to have a |
@nlf I did not have a For debugging, I cloned this repo and ran No source files of the repo were deleted though. I'm specifying the full path to |
Okay, it seems the repository having an error was a red herring. I've reproduced the issue with a much simpler case. I have a private repo in In
In
Note that the reason Worth noting that yarn does not have this issue, so a workaround is to use I hope this new info helps! |
@JoshuaWalsh that did help! i'm able to reproduce this now and am working on figuring out exactly what's going on. thank you for the logs and the detailed information! |
this should be fixed in the latest release |
@kdy1 does the same thing happen on npm v7.18.1? |
Closing in favor of the actual issue opened for the new bug. |
Note that this same issue was reported back in 2017 on the now-archived repo: npm/npm#15783
Current Behavior:
I am using
npm link
to try to test changes I am making to an upstream dependency within my own project. In the dependency directory I runnpm link
. Then in my own project I runnpm link ffmpeg-stream
.NPM gives the following error message when running the second link command:
Afterwards, the directory of the upstream dependency is empty. Even the
.git
directory is deleted, so tough luck if you haven't pushed recently.Expected Behavior:
NPM link should link the package without issue. If an error is encountered, NPM should not delete the entire folder contents.
Steps To Reproduce:
Clone
https://github.com/JoshuaWalsh/node-ffmpeg-stream/
Clone
https://github.com/JoshuaWalsh/subtitle-indexer
In
node-ffmpeg-stream
, runnpm ci --include=prod
In
node-ffmpeg-stream
, runnpm link
In
subtitle-indexer
, runnpm link ffmpeg-stream
Observe that the
node-ffmpeg-stream
directory is now empty. (A small number of files may remain if they were in use at the time and couldn't be deleted)Environment:
I am using
nvm-windows
to manage NodeJS, but currently only have one version installed.The text was updated successfully, but these errors were encountered: