Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

npm rm can cause node_modules to be in invalid state #5698

Closed
Raynos opened this issue Jul 15, 2014 · 2 comments
Closed

npm rm can cause node_modules to be in invalid state #5698

Raynos opened this issue Jul 15, 2014 · 2 comments
Labels
Milestone

Comments

@Raynos
Copy link
Contributor

Raynos commented Jul 15, 2014

This is a "dependency tree realization" bug.

The problem here is that invoking npm rm module may cause the node_modules tree to be in an invalid state because npm rm is not dedupe aware.

Reproduction case:

mkdir ~/tmp/foobar
cd ~/tmp/foobar
npm init
npm i routes@1.1.0 -S
npm i routes-router@3.3.0 -S
npm ls
echo "npm ls is good $?"
npm rm routes -S
npm ls
echo "npm ls should be good but is bad $?"

The expected output is that the second npm ls exits zero instead of one.

Suggested fix:

Break the logic that is lib/update.js that finds all copies of module in a node_modules tree out into a function.

Then use that function to find all copies in lib/uninstall.js and then just invoke npm.commands.install for each one.

@Raynos
Copy link
Contributor Author

Raynos commented Jul 15, 2014

cc @othiym23

@othiym23 othiym23 added the bug label Sep 18, 2014
@othiym23 othiym23 added this to the multi-stage install milestone Sep 18, 2014
@iarna
Copy link
Contributor

iarna commented Dec 15, 2014

I'm closing this as it will be fixed by the feature implemented in #6936, further discussion should happen there.

@iarna iarna closed this as completed Dec 15, 2014
@npm npm locked and limited conversation to collaborators Jun 24, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants