npm模块安装位置问题

2013-02-07 01:01:24 +08:00
 atan
没有使用-g参数,根据文档说明,模块应该是安装在当前目录里,可我所有模块却是安装在/home/[用户名]/node_modules里,是什么原因啊?
4638 次点击
所在节点    Node.js
2 条回复
luin
2013-02-07 01:21:56 +08:00
https://npmjs.org/doc/folders.html

Starting at the $PWD, npm will walk up the folder tree checking for a folder that contains either a package.json file, or a node_modules folder. If such a thing is found, then that is treated as the effective "current directory" for the purpose of running npm commands. (This behavior is inspired by and similar to git's .git-folder seeking logic when running git commands in a working dir.)

If no package root is found, then the current folder is used.
Jat001
2013-02-07 03:02:30 +08:00
请用 -d

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/59998

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX