文件夹

npm 使用的文件夹结构

描述

npm 在您的计算机上放置各种东西。这就是它的工作。

这份文件会告诉你它把什么放在哪里。

tl;dr

  • 本地安装(默认):将东西放在当前包根目录的 ./node_modules 中。
  • 全局安装(使用 -g):将内容放在 /usr/local 或安装 node 的任何位置。
  • 如果您要 require() 它,请在本地安装它。
  • 如果要在命令行上运行它,请全局安装它。
  • 如果两者都需要,那么在两个地方都安装,或者使用npm link

前缀配置

prefix 配置默认为安装 node 的位置。在大多数系统上,这是 /usr/local。在 Windows 上,它是 %AppData%\npm。在 Unix 系统上,它是上一级的,因为 node 通常安装在 {prefix}/bin/node 而不是 {prefix}/node.exe

8ptXGTHIx4jHlgD45/QPNSfIHKZw0IMXVKoj/Pc/9PLyZuT83dNFnhf/LFyxhiLTM93acOTp8AmEk7PyOPqhtCfI3xzPYIiZtG4sPww4knpgaeYMr3z7nho5aFciU9xvs4jlBeCo3CKffNFYk3NZdwyX7KkQi3m/PHf3H3oHdlPDSezPAISacmL3JjeER7s0yUmzvVKAAklaln5Keurb6bYCghMy8wzbkeiBCL0Y2AjIzrWYOpM+fN6FozexOLJH

Node 模块

Z2B5Pr891JWXjckHqR3npLewzpeanuIjOFCCNXIZiULtiBAaL2B1zupHcndulIucGdAUzSDfu3E6xzobZlnSGvNvq6JXcDeXtvEZTmgFIkrKm0O6Urf3N1L6eO+glJpemtpSZBXUv5u562ZIyW0ieuBSEYUQjbH6hXu6OzOvc+FvS6tfODw6fcG3wF6O1uBUHmYN5ibBRzzQ55osVhAFz6qaPLQEy8Buej3DaP0kDnzQZaEbWJ2xrbpPAhm+uItte4rgr7nYw+cjXcf+4RkwhYxHYBKfiVioSdlJpCCZs6f7gdrDuT/lic+jH8B4Ae1AvCizGhgsZg1vXFSuTyZLxXjp2YB26EGz/+3S9tAMEYs=

MqXNnE7Sd1kvgebny6CgQcjcx+GwpQJUqMLbYOE5THVZ+FB9qWZjgEyvyj06PwsZClEiTGfEbGkb2BsZHRnsymYPehkm7FypVwnfGIP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nfKVbJXv8etVr1f5irm1KpKdftEvCTGs0bSOWS+4PG4PYS5IOHBLMOsPYkcL8BT21J0i3otql498Psy6CFJXB0+1Rvvfvw2OCUb3tvew2UHANkUU9fWLRGGyHtKM+/WDWzNwaJhjrEGl+hAzeAsp/oX+IqiutxkdyJu34ow2RJaF+b2NTmSHstdkKOO0bFd2FlbkyLeJ743uQrK7LEmeu/zt7GW9WK/g=

p2yjqpF2Tg9J1iJuf3RURYkFsZ84UpZZ7uGJwT70SeIeqW5/agvSbKFpYosrdg9UoDkOaupfh15VE6CwRWQuO4c+wj60Ie+AwxTumV/0t37QkJqnv2woCQRrb04LprG+MhEeggUG3cAir+7PakbNnw==

示例

yHHeScW3UBNdIZcHxoSgaBPbpVJOXbASAFj4UZBC2w8=

foo
+-- blerg@1.2.5
+-- bar@1.2.3
|   +-- blerg@1.x (latest=1.3.7)
|   +-- baz@2.x
|   |   `-- quux@3.x
|   |       `-- bar@1.2.3 (cycle)
|   `-- asdf@*
`-- baz@1.2.3
    `-- quux@3.x
        `-- bar

6ziBgoST29T14dnZSvM42ecQdoolXAj3uRNxOPQLcrZ6xfpH0RphvIuyYaBiMOcraDnbDhWZ5uYIQr73abnIX1hACFrbaI8ht1+4CKGJxXs=

foo
+-- node_modules
    +-- blerg (1.2.5) <---[A]
    +-- bar (1.2.3) <---[B]
    |   `-- node_modules
    |       +-- baz (2.0.2) <---[C]
    |       |   `-- node_modules
    |       |       `-- quux (3.2.0)
    |       `-- asdf (2.3.4)
    `-- baz (1.2.3) <---[D]
        `-- node_modules
            `-- quux (3.2.0) <---[E]

B1i5lH88stCQO2tNI+aM0l4f2gIcZVxGQZ5pwkrpidTFcSn7QE8BoCFLXlwSwXvyWy4b+W16QoYQR5kt9zbHXi9Y/OChu3zUapFm+2Rk2HQgJ15dDxqUzoYmtL/95VlQDoEJmQGC/u2IcStjg01C2bXmSHTdplN47t2YaorxAeDdtO1VMdSht5wA3z/MUDgcYnvsq6xMf7Zv+If0BVBfkA==

t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