Home > database >  How do you make npm install locally?
How do you make npm install locally?

Time:07-05

NPM will not install packages locally, update package.json, nor update package.lock. It's a very perplexing issue honestly. Pseudo-steps to reproduce are:

  1. mkdir testFolder
  2. cd testFolder
  3. npm init -> use defaults
  4. npm install dotenv

I'm running Windows 11.

  • I tried running with Developer mode on and off
  • I tried installing node (16.15.1)/npm via NVM4W (1.1.9) and using npm install <package>
  • I uninstalled NVM4W and installed node (18.4.0) directly

I'm kind of at a loss for things to try now. It feels like there's some Windows setting somewhere I'm missing that's causing all these problems

CodePudding user response:

For me, it turned out that I had modified my C:\Users{user}.npmrc file which had the setting "location=global" set. I deleted the setting and it all worked.

This got set, I believe, because I did npm config set local=global earlier due to a deprecation warning I received using an older version of npm.

  • Related