Where does npm install packages?

后端 未结 23 1782
梦毁少年i
梦毁少年i 2020-11-22 06:03

Can someone tell me where can I find the Node.js modules, which I installed using npm?

23条回答
  •  离开以前
    2020-11-22 06:40

    From the docs:

    In npm 1.0, there are two ways to install things:

    • globally —- This drops modules in {prefix}/lib/node_modules, and puts executable files in {prefix}/bin, where {prefix} is usually something like /usr/local. It also installs man pages in {prefix}/share/man, if they’re supplied.

    • locally —- This installs your package in the current working directory. Node modules go in ./node_modules, executables go in ./node_modules/.bin/, and man pages aren’t installed at all.

    You can get your {prefix} with npm config get prefix. (Useful when you installed node with nvm).

提交回复
热议问题