npm not defaulting local installs to ./node_module

2019-07-08 08:36发布

When I try to do a local install (eg. npm install socket.io), it's putting the module in the ~/src/node_modules/ folder. npm root reports this folder as well. I must have screwed up npm's settings during some bleary eyed late night session, but I can't figure out how to get it set back to ./node_modules as the default. Anyone know what I screwed up, and how to set it back to the default?

Update

I have tried npm config set root ./node_modules but npm root still reports ~/src/node_modules as the root. I also checked .bash_profile and no node related settings are being made in it.

标签: npm
1条回答
迷人小祖宗
2楼-- · 2019-07-08 08:59

A quick npm uninstall npm -g and then another install from the npm website should get your defaults back.

Normally reinstalling is a pain but with your package.json files you can get everything set back up with a quick npm link

查看更多
登录 后发表回答