Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix npm install --prefix on windows
I found that globalDir/localDir and globalPrefix/localPrefix end up being the same value when `--prefix` is set. This was surprising to me, but it does appear that `globalPrefix` is set to match `prefix` at the end of loading. This means that the globalTop logic is actually incorrect here. It accidentally worked on non-windows machines. For example if running `npm i --prefix scripts` On non-windows this.npm.globalDir = $CWD/scripts/lib/node_modules On windows this.npm.globalDir = $CWD/scripts/node_modules IMHO, the logic inside of npmconfig is also incorrect here, since globalDir is being set to this bogus `$CWD/scripts/lib/node_modules` However, this fix should work regardless - since it stops relying on the specific values of globalDir. Fixes npm#7722 I manually tested `npm install` and `npm install --prefix` on both windows and mac. Everything works now.
- Loading branch information