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.

  • 相关阅读:
    vue生命周期钩子函数
    mongodb window安装配置
    git 添加远程仓
    webpack + vue + node 打造单页面(入门篇)
    git 命令
    javascript 利用FileReader和滤镜上传图片预览
    javascript 一些特殊的字符运算
    Es6 Symbol.iterator
    配置 github 上的程序
    Redis 的数据类型
  • 原文地址:https://www.cnblogs.com/chucklu/p/12917669.html
Copyright © 2011-2022 走看看