11cb0ef41Sopenharmony_ci---
21cb0ef41Sopenharmony_cititle: npm-prefix
31cb0ef41Sopenharmony_cisection: 1
41cb0ef41Sopenharmony_cidescription: Display prefix
51cb0ef41Sopenharmony_ci---
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci### Synopsis
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci```bash
101cb0ef41Sopenharmony_cinpm prefix [-g]
111cb0ef41Sopenharmony_ci```
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciNote: This command is unaware of workspaces.
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ci### Description
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ciPrint the local prefix to standard output. This is the closest parent directory
181cb0ef41Sopenharmony_cito contain a `package.json` file or `node_modules` directory, unless `-g` is
191cb0ef41Sopenharmony_cialso specified.
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ciIf `-g` is specified, this will be the value of the global prefix. See
221cb0ef41Sopenharmony_ci[`npm config`](/commands/npm-config) for more detail.
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ci### Example
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ci```bash
271cb0ef41Sopenharmony_cinpm prefix
281cb0ef41Sopenharmony_ci/usr/local/projects/foo
291cb0ef41Sopenharmony_ci```
301cb0ef41Sopenharmony_ci
311cb0ef41Sopenharmony_ci```bash
321cb0ef41Sopenharmony_cinpm prefix -g
331cb0ef41Sopenharmony_ci/usr/local
341cb0ef41Sopenharmony_ci```
351cb0ef41Sopenharmony_ci
361cb0ef41Sopenharmony_ci### Configuration
371cb0ef41Sopenharmony_ci
381cb0ef41Sopenharmony_ci#### `global`
391cb0ef41Sopenharmony_ci
401cb0ef41Sopenharmony_ci* Default: false
411cb0ef41Sopenharmony_ci* Type: Boolean
421cb0ef41Sopenharmony_ci
431cb0ef41Sopenharmony_ciOperates in "global" mode, so that packages are installed into the `prefix`
441cb0ef41Sopenharmony_cifolder instead of the current working directory. See
451cb0ef41Sopenharmony_ci[folders](/configuring-npm/folders) for more on the differences in behavior.
461cb0ef41Sopenharmony_ci
471cb0ef41Sopenharmony_ci* packages are installed into the `{prefix}/lib/node_modules` folder, instead
481cb0ef41Sopenharmony_ci  of the current working directory.
491cb0ef41Sopenharmony_ci* bin files are linked to `{prefix}/bin`
501cb0ef41Sopenharmony_ci* man pages are linked to `{prefix}/share/man`
511cb0ef41Sopenharmony_ci
521cb0ef41Sopenharmony_ci
531cb0ef41Sopenharmony_ci
541cb0ef41Sopenharmony_ci### See Also
551cb0ef41Sopenharmony_ci
561cb0ef41Sopenharmony_ci* [npm root](/commands/npm-root)
571cb0ef41Sopenharmony_ci* [npm folders](/configuring-npm/folders)
581cb0ef41Sopenharmony_ci* [npm config](/commands/npm-config)
591cb0ef41Sopenharmony_ci* [npmrc](/configuring-npm/npmrc)
60