sindresorhus / global-directory

Get the directory of globally installed packages and binaries
MIT License
75 stars 10 forks source link

:bug: Path not set correctly #22

Closed rubenaeg closed 2 years ago

rubenaeg commented 3 years ago

I installed vanilla Node.js@v14.18.0 and setup a project with global-dirs and oclif. Essentially I'm trying to access the path where the package will be installed in the end to load additional globally installed plugins, which should be C:\Users\<me>\AppData\Roaming\npm\node_modules\.

PS C:\Users> node --version
v14.18.0

On Linux this runs fine, but on Windows the correct npmrc cannot be found, thus the default path is used. Node.js now installs the file under C:\Program Files\nodejs\node_modules\npm\, while installing global modules under %APPDATA%\npm\.

mgenware commented 2 years ago

Can repro on a fresh node v17.2.0 install (from official site msi) on windows 11. I installed node on a custom location. <global-dirs>.npm.packages returns <custom location>\node_modules, whereas npm list -g prints C:\Users\<User>\AppData\Roaming\npm.

mgenware commented 2 years ago

FWIW another similar module seems to be working fine