# How to reset npm's local install directory to its default?

**URL:** <http://community.latenode.com/t/how-to-reset-npms-local-install-directory-to-its-default/7016>\
**Category:** NPM\
**Created:** [March 11, 2025, 7:08pm UTC](http://community.latenode.com/t/how-to-reset-npms-local-install-directory-to-its-default/7016 "2025-03-11T19:08:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zack\_45Gaming](http://community.latenode.com/letter_avatar_proxy/v4/letter/z/ed8c4c/32.png) [@Zack\_45Gaming](http://community.latenode.com/u/Zack_45Gaming)\
**Post date:** [March 11, 2025, 7:08pm UTC](http://community.latenode.com/t/how-to-reset-npms-local-install-directory-to-its-default/7016/1 "2025-03-11T19:08:00Z")

</div>

I’m facing an issue with how npm installs packages locally. When I run `npm install somepackage`, it puts the modules in `~/src/node_modules/` instead of the expected `./node_modules`. I suspect I might have altered some settings during a late night session, but now I can’t find out how to revert those changes.

I tried executing `npm config set root ./node_modules`, but running `npm root` still shows `~/src/node_modules`. I even checked my `.bash_profile` for any modifications related to node, but nothing seems off.

Does anyone have any suggestions on how to restore npm to its default local install directory? Any help would be greatly appreciated!

Example scenario:

```auto
$ pwd
/home/user/myproject

$ npm install express
...
added 57 packages in 2s

$ ls node_modules
# Empty!

$ ls ~/src/node_modules
express, other-packages, ...

```

I’m really stuck on this, so any advice is welcome.

---

<div class="post-metadata">

**Author:** ![HappyDancer99](http://community.latenode.com/letter_avatar_proxy/v4/letter/h/ebca7d/32.png) [@HappyDancer99](http://community.latenode.com/u/HappyDancer99)\
**Post date:** [March 20, 2025, 2:24pm UTC](http://community.latenode.com/t/how-to-reset-npms-local-install-directory-to-its-default/7016/2 "2025-03-20T14:24:19Z")

</div>

I’ve encountered a similar issue before, and it can be quite frustrating. Here’s what worked for me:

First, check for any .npmrc files in your home directory or project folder. These can override default settings. If you find any, review and remove any custom configurations related to install directories.

Next, try running `npm config delete prefix` to remove any custom prefix settings. This often resolves issues with non-standard install locations.

If that doesn’t work, you might want to clear your npm cache with `npm cache clean --force`. Sometimes cached data can cause weird behaviors.

As a last resort, consider uninstalling and reinstalling npm. I’ve had to do this a couple of times, and it usually fixes any lingering configuration issues.

Remember to always double-check your environment variables too. A misconfigured NODE\_PATH can sometimes cause npm to behave unexpectedly.

Hope this helps you get back to your default setup!

---

<div class="post-metadata">

**Author:** ![Tom01\_Wonder](http://community.latenode.com/letter_avatar_proxy/v4/letter/t/ecb155/32.png) [@Tom01\_Wonder](http://community.latenode.com/u/Tom01_Wonder)\
**Post date:** [March 18, 2025, 10:40pm UTC](http://community.latenode.com/t/how-to-reset-npms-local-install-directory-to-its-default/7016/3 "2025-03-18T22:40:26Z")

</div>

Have you checked for any global npm configurations? Run `npm config ls -l` to see all settings, including defaults. Look for anything related to prefix or root. If you spot something off, try `npm config delete <setting>` to remove it.

Also, check your home directory for a `.npmrc` file. If it exists and has odd settings, either edit or remove it. Sometimes, a rogue global config can cause this behavior.

As a last resort, you might want to consider reinstalling npm. You can do this with `npm install -g npm@latest`. This often resolves weird configuration issues.

Remember to clear your npm cache with `npm cache clean --force` after making changes. Then try installing a package in a new project directory to see if the issue is resolved.

---

<div class="post-metadata">

**Author:** ![Claire29](http://community.latenode.com/letter_avatar_proxy/v4/letter/c/919ad9/32.png) [@Claire29](http://community.latenode.com/u/Claire29)\
**Post date:** [March 18, 2025, 2:25pm UTC](http://community.latenode.com/t/how-to-reset-npms-local-install-directory-to-its-default/7016/4 "2025-03-18T14:25:52Z")

</div>

hey man, sounds like u messed with npm’s settings.  
try checkin for any .npmrc files in ur project or home folder.  
if u find any, delete em or remove any weird settings.  
then run `npm config rm prefix` to reset stuff.  
after that, delete node\_modules and run npm install again. that should fix it!
