I have specified a package in my package.json that I have also linked with a local version I use for development. When I run npm i in the parent package, the symlink is removed, the package is installed from npm, and I use the live version instead, not my local development one.
Later, if I run npm link, the package correctly get linked with my local version, but everything is replaced with the downloaded version, meaning that all my local development files are replaced with the contents of the tarball downloaded from npm. This means I have to go in my package folder, clone the repo again, checkout the files from the master branch... Not to mention that if I have any unsaved work, it would get completely erased with no chance to get it back even via Git - because the .git folder is also deleted.
Current Behavior:
- running
npm i removes linked packages and installs their published versions instead
- running
npm link <package> replaces the contents of the symlinked package folder with the published package's tarball contents
Expected Behavior:
- running
npm i should ignore packages in node_modules that are symlinked
- running
npm link <package> should only create a symlink and leave everything in the symlinked folder intact
Steps To Reproduce:
- Install a package from npm in a project
- Run
npm link in a different, local version of the package
- Run
npm link <package> in the project
- Run
npm i
- Linked package is removed
- Run
npm link <package> in the project
- Local version is replaced with the published tarball contents
Environment:
- OS: Microsoft Windows 10 Pro, 10.0.18363 Build 18363
- nvm: 1.1.7
- Node: 15.4.0
- npm: 7.0.15 (can't install 7.2 due to nvm)
I have specified a package in my package.json that I have also linked with a local version I use for development. When I run
npm iin the parent package, the symlink is removed, the package is installed from npm, and I use the live version instead, not my local development one.Later, if I run
npm link, the package correctly get linked with my local version, but everything is replaced with the downloaded version, meaning that all my local development files are replaced with the contents of the tarball downloaded from npm. This means I have to go in my package folder, clone the repo again, checkout the files from the master branch... Not to mention that if I have any unsaved work, it would get completely erased with no chance to get it back even via Git - because the.gitfolder is also deleted.Current Behavior:
npm iremoves linked packages and installs their published versions insteadnpm link <package>replaces the contents of the symlinked package folder with the published package's tarball contentsExpected Behavior:
npm ishould ignore packages innode_modulesthat are symlinkednpm link <package>should only create a symlink and leave everything in the symlinked folder intactSteps To Reproduce:
npm linkin a different, local version of the packagenpm link <package>in the projectnpm inpm link <package>in the projectEnvironment: