Skip to content

[BUG] npm link fails and deletes entire project #2104

Description

@YoshiWalsh

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 run npm link. Then in my own project I run npm link ffmpeg-stream.

NPM gives the following error message when running the second link command:

npm ERR! code 1
npm ERR! path D:\git\node-ffmpeg-stream
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c "tsc"
npm ERR! Version 3.9.7
npm ERR! Syntax: tsc [options] [file...]

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:

  1. Clone https://github.com/JoshuaWalsh/node-ffmpeg-stream/

  2. Clone https://github.com/JoshuaWalsh/subtitle-indexer

  3. In node-ffmpeg-stream, run npm ci --include=prod

  4. In node-ffmpeg-stream, run npm link

  5. In subtitle-indexer, run npm link ffmpeg-stream

  6. 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:

  • OS: Windows 10 Pro 10.0.19042
  • Node: 15.0.1
  • npm: 7.0.3

I am using nvm-windows to manage NodeJS, but currently only have one version installed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingRelease 7.xwork is associated with a specific npm 7 releaseplatform:windowsis Windows-specific

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions