zoukankan      html  css  js  c++  java
  • npm-folders

    https://docs.npmjs.com/configuring-npm/folders.html

    npm puts various things on your computer. That’s its job.

    This document will tell you what it puts where.

    tl;dr§

    • Local install (default): puts stuff in ./node_modules of the current package root.
    • Global install (with -g): puts stuff in /usr/local or wherever node is installed.
    • Install it locally if you’re going to require() it.
    • Install it globally if you’re going to run it on the command line.
    • If you need both, then install it in both places, or use npm link.

    prefix Configuration§

    The prefix config defaults to the location where node is installed. On most systems, this is /usr/local. On Windows, it’s %AppData% pm. On Unix systems, it’s one level up, since node is typically installed at {prefix}/bin/node rather than {prefix}/node.exe.

    When the global flag is set, npm installs things into this prefix. When it is not set, it uses the root of the current package, or the current working directory if not in a package already.

    Node Modules§

    Packages are dropped into the node_modules folder under the prefix. When installing locally, this means that you can require("packagename") to load its main module, or require("packagename/lib/path/to/sub/module") to load other modules.

    Global installs on Unix systems go to {prefix}/lib/node_modules. Global installs on Windows go to {prefix}/node_modules (that is, no lib folder.)

    Scoped packages are installed the same way, except they are grouped together in a sub-folder of the relevant node_modules folder with the name of that scope prefix by the @ symbol, e.g. npm install @myorg/package would place the package in {prefix}/node_modules/@myorg/package. See scope for more details.

    If you wish to require() a package, then install it locally.

  • 相关阅读:
    matlab基础知识
    reverse number
    C++基础知识(一)
    ES6 let const学习
    [ZZ]一名IT从业者的英语口语能力成长路径
    使用windows Live Writer 以及office word 2013发布文章到博客园总结
    CString.format的用法
    Cstring 与 string 注意点
    卡尔曼滤波应用
    linux 重新挂载分区(教程)
  • 原文地址:https://www.cnblogs.com/chucklu/p/12917669.html
Copyright © 2011-2022 走看看