[BUG] 'npm install' deletes custom node modules
Open
Nobody has claimed this yet.
Bug
Priority 2
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
my custom node_module got deleted after doing npm install -D vite, its not vite's fault, everything from npm would delete it
Expected Behavior
well, my stuff shouldnt be gone
Steps To Reproduce
- make a node_modules diretory with a new folder in it, put anything you want in it, like an important part of your app
2.npm installanything, likenpm install -D vite
3.boom your code is gone
Environment
- npm: all versions
- Node.js: v22.11.0
- OS Name: windows 10
- System Model Name: windows?
- npm config: ``
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the report on Windows with a custom directory inside node_modules, then run npm install -D vite and inspect the npm CLI install behavior that removes it. Done means custom node_modules content is preserved as appropriate and a regression test covers the reported installation scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100