当我尝试进行本地安装(例如npm install socket.io
)时,它会将模块放入~/src/node_modules/
文件夹中。npm root
也报告此文件夹。在一些睡眼惺忪的深夜会议期间,我一定搞砸了 npm 的设置,但我不知道如何将其设置./node_modules
为默认值。任何人都知道我搞砸了什么,以及如何将其设置回默认值?
更新
我已经尝试过npm config set root ./node_modules
,但npm root
仍以~/src/node_modules
root 身份报告。我还检查了 .bash_profile 并且没有在其中进行与节点相关的设置。