[BUG] `npm i` tries to recreate root directory (drive letter) in Windows
Open
Nobody has claimed this yet.
Bug
Needs Triage
Release 9.x
- 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
On Windows when you have a disk partition (W:\) specificly reserved for a package it doesn't detect where node_modules are.

Expected Behavior
npm install should install packages as expected
Steps To Reproduce
- Create Windows disk partition and set drive letter to W
- Go to
cd W:\ - Run
npm install <any package>
Environment
- npm: 9.6.5
- Node.js: v19.9.0
- OS Name: Windows 10 Home Single Language (latest version date 5 May 2023)
- System Model Name: Omen HP 15-CE008NT
- npm config:
PS W:\> npm config get
; "builtin" config from C:\Users\eaksy\AppData\Roaming\npm\node_modules\npm\npmrc
prefix = "C:\\Users\\eaksy\\AppData\\Roaming\\npm"
; node bin location = C:\Program Files (x86)\nodejs\node.exe
; node version = v19.9.0
; npm local prefix = W:\
; npm version = 9.6.5
; cwd = W:\
; HOME = C:\Users\eaksy
; Run `npm config ls -l` to show all defaults.
Note: Computer newly formatted, everything in fresh installation
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
Reproduce the issue on Windows from a W:\ drive root using npm 9.6.5 and a current Node.js version. Trace npm CLI handling of the local prefix and node_modules when the working directory is W:; done means npm install succeeds without trying to recreate the drive-letter root.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100