npm 不默认本地安装到 ./node_modules
当我尝试进行本地安装(例如 npm install socket.io )时,它将模块放入 ~/src/node_modules/ 文件夹中。 npm root
也会报告此文件夹。我一定是在某个睡眼惺忪的深夜会议期间搞砸了 npm 的设置,但我不知道如何将其设置回 ./node_modules
作为默认值。有人知道我搞砸了什么,以及如何将其设置回默认值吗?
更新
我已尝试 npm config set root ./node_modules
但 npm root
仍将 ~/src/node_modules
报告为根。我还检查了 .bash_profile ,其中没有进行与节点相关的设置。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
快速
npm uninstall npm -g
然后从 npm 网站再次安装应该会恢复默认设置。通常重新安装很痛苦,但使用 package.json 文件,您可以通过快速
npm 链接
恢复所有设置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