Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
npm.md149 linesDownload Raw Back to commands
1---
2title: npm
3section: 1
4description: javascript package manager
5---
6
7### Synopsis
8
9```bash
10npm
11```
12
13Note: This command is unaware of workspaces.
14
15### Version
16
1711.12.1
18
19### Description
20
21npm is the package manager for the Node JavaScript platform.
22It puts modules in place so that node can find them, and manages dependency conflicts intelligently.
23
24It is extremely configurable to support a variety of use cases.
25Most commonly, you use it to publish, discover, install, and develop node programs.
26
27Run `npm help` to get a list of available commands.
28
29### Important
30
31npm comes preconfigured to use npm's public registry at https://registry.npmjs.org by default.
32Use of the npm public registry is subject to terms of use available at https://docs.npmjs.com/policies/terms.
33
34You can configure npm to use any compatible registry you like, and even run your own registry.
35Use of someone else's registry is governed by their terms of use.
36
37### Introduction
38
39You probably got npm because you want to install stuff.
40
41The very first thing you will most likely want to run in any node program is `npm install` to install its dependencies.
42
43You can also run `npm install blerg` to install the latest version of "blerg".  Check out [`npm install`](/commands/npm-install) for more info.
44It can do a lot of stuff.
45
46Use the `npm search` command to show everything that's available in the public registry.
47Use `npm ls` to show everything you've installed.
48
49### Dependencies
50
51If a package lists a dependency using a git URL, npm will install that dependency using the [`git`](https://github.com/git-guides/install-git) command and will generate an error if it is not installed.
52
53If one of the packages npm tries to install is a native node module and requires compiling of C++ Code, npm will use [node-gyp](https://github.com/nodejs/node-gyp) for that task.
54For a Unix system, [node-gyp](https://github.com/nodejs/node-gyp) needs Python, make and a buildchain like GCC. On Windows, Python and Microsoft Visual Studio C++ are needed.
55For more information visit [the node-gyp repository](https://github.com/nodejs/node-gyp) and the [node-gyp Wiki](https://github.com/nodejs/node-gyp/wiki).
56
57### Directories
58
59See [`folders`](/configuring-npm/folders) to learn about where npm puts stuff.
60
61In particular, npm has two modes of operation:
62
63* local mode:
64  npm installs packages into the current project directory, which defaults to the current working directory.
65  Packages install to `./node_modules`, and bins to `./node_modules/.bin`.
66* global mode:
67  npm installs packages into the install prefix at `$NPM_CONFIG_PREFIX/lib/node_modules` and bins to `$NPM_CONFIG_PREFIX/bin`.
68
69Local mode is the default.
70Use `-g` or `--global` on any command to run in global mode instead.
71
72### Developer Usage
73
74If you're using npm to develop and publish your code, check out the following help topics:
75
76* json:
77  Make a package.json file.
78  See [`package.json`](/configuring-npm/package-json).
79* link:
80  Links your current working code into Node's path, so that you don't have to reinstall every time you make a change.
81  Use [`npm link`](/commands/npm-link) to do this.
82* install:
83  It's a good idea to install things if you don't need the symbolic link.
84  Especially, installing other peoples code from the registry is done via [`npm install`](/commands/npm-install)
85* adduser:
86  Create an account or log in.
87  When you do this, npm will store credentials in the user config file.
88* publish:
89  Use the [`npm publish`](/commands/npm-publish) command to upload your code to the registry.
90
91#### Configuration
92
93npm is extremely configurable.
94It reads its configuration options from 5 places.
95
96* Command line switches:
97  Set a config with `--key val`.
98  All keys take a value, even if they are booleans (the config parser doesn't know what the options are at the time of parsing).
99  If you do not provide a value (`--key`) then the option is set to boolean `true`.
100* Environment Variables:
101  Set any config by prefixing the name in an environment variable with `NPM_CONFIG_`.
102  For example, `export NPM_CONFIG_KEY=val`.
103* User Configs:
104  The file at `$HOME/.npmrc` is an ini-formatted list of configs.
105  If present, it is parsed.
106  If the `userconfig` option is set in the cli or env, that file will be used instead.
107* Global Configs:
108  The file found at `./etc/npmrc` (relative to the global prefix will be parsed if it is found.
109  See [`npm prefix`](/commands/npm-prefix) for more info on the global prefix.
110  If the `globalconfig` option is set in the cli, env, or user config, then that file is parsed instead.
111* Defaults:
112  npm's default configuration options are defined in `lib/utils/config/definitions.js`.
113  These must not be changed.
114
115See [`config`](/using-npm/config) for much, much, more information.
116
117### Contributions
118
119Patches welcome!
120
121If you would like to help, but don't know what to work on, read the [contributing guidelines](https://github.com/npm/cli/blob/latest/CONTRIBUTING.md) and check the issues list.
122
123### Bugs
124
125When you find issues, please report them:
126<https://github.com/npm/cli/issues>
127
128Please be sure to follow the template and bug reporting guidelines.
129
130### Feature Requests
131
132Discuss new feature ideas on our discussion forum:
133
134* <https://github.com/orgs/community/discussions/categories/npm>
135
136Or suggest formal RFC proposals:
137
138* <https://github.com/npm/rfcs>
139
140### See Also
141
142* [npm help](/commands/npm-help)
143* [package.json](/configuring-npm/package-json)
144* [npmrc](/configuring-npm/npmrc)
145* [npm config](/commands/npm-config)
146* [npm install](/commands/npm-install)
147* [npm prefix](/commands/npm-prefix)
148* [npm publish](/commands/npm-publish)
149 
codekingpro/portable-devtools · Team Ai