V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
atan
V2EX  ›  Node.js

npm模块安装位置问题

  •  
  •   atan · 2013-02-07 01:01:24 +08:00 · 4626 次点击
    这是一个创建于 4316 天前的主题,其中的信息可能已经有所发展或是发生改变。
    没有使用-g参数,根据文档说明,模块应该是安装在当前目录里,可我所有模块却是安装在/home/[用户名]/node_modules里,是什么原因啊?
    2 条回复    1970-01-01 08:00:00 +08:00
    luin
        1
    luin  
       2013-02-07 01:21:56 +08:00 via iPhone
    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
        2
    Jat001  
       2013-02-07 03:02:30 +08:00   ❤️ 1
    请用 -d
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5514 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 07:34 · PVG 15:34 · LAX 23:34 · JFK 02:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.