Differences between revisions 4 and 6 (spanning 2 versions)
Revision 4 as of 2023-01-08 17:25:55
Size: 1419
Comment:
Revision 6 as of 2023-04-08 17:34:36
Size: 1470
Comment:
Deletions are marked like this. Additions are marked like this.
Line 42: Line 42:
For more details, see [[NodeJS/NPM|here]].
Line 57: Line 55:
----



== See also ==

[[https://man.archlinux.org/man/community/npm/npm.1.en|npm(1)]]

NPM

npm(1) (Node Package Manager) is a package manager for third-party Node modules.

See also yarn and npx.


Installation

npm(1) is bundled with node(1).


Usage

Modules can be installed locally or globally.

Local installation uses ./node_modules for modules and ./node_modules/bin for binaries. This is the default behavior.

npm install jquery

Global installation uses $NPM_CONFIG_PREFIX/lib/node_modules for modules and $NPM_CONFIG_PREFIX/bin for binaries. To enable this mode, include the --global flag (or -g for short).

npm install jquery -g

If $NPM_CONFIG_PREFIX is not set, the default can be inspected using:

NPM_CONFIG_PREFIX= npm prefix -g


Configuration

npm(1) uses environment variables for configuration, all prefixed with NPM_CONFIG_.

Variable

Default

Meaning

NPM_CONFIG_PREFIX

see above

global installation directory

NPM_CONFIG_CACHE

~/.npm, %APPDATA%/npm-cache

package cache directory

NPM_CONFIG_DEVDIR

~/.node-gyp

native addon build directory


See also

npm(1)


CategoryRicottone

Node/Npm (last edited 2023-04-08 17:34:36 by DominicRicottone)