Can't use node modules installed by NPM despite correct NODE_PATH on a Mac

一笑奈何 提交于 2019-12-07 06:13:43

问题


Running on OSX 10.7 (Lion). Tried including as much detail here. I (foolishly?) decided to upgrade to the latest NODE and NPM. I git-ed and curl-ed like a good boy, and ended up with this:

>node -v
v0.5.9
>npm -v
1.0.99

added export NODE_PATH=/usr/local/lib/node_modules:/usr/local/lib/node which yields:

>echo $NODE_PATH
/usr/local/lib/node_modules:/usr/local/lib/node

But every require I have in all my scripts fails in finding any of my modules. It either looks in the local library, or just gives up with an "Error: Cannot find module" message.

I tried variations on the NODE_PATH: with/without the node_modules, with specific directories - nada.

Am I missing some NPM configuration? Am I using it incorrectly? All the scripts worked well prior to the upgrade.

Thanks for any help.


回答1:


Finally solved it by installing modules locally into the specific node directories.



来源:https://stackoverflow.com/questions/7814598/cant-use-node-modules-installed-by-npm-despite-correct-node-path-on-a-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!