reggi/cache-based-on-version
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: npm-prefix |
| 3 | section: 1 |
| 4 | description: Display prefix |
| 5 | github_repo: npm/cli |
| 6 | github_branch: release/v8 |
| 7 | github_path: docs/lib/content/commands/npm-prefix.md |
| 8 | redirect_from: |
| 9 | - /cli-documentation/v8/cli-commands/npm-prefix |
| 10 | - /cli-documentation/v8/cli-commands/prefix |
| 11 | - /cli-documentation/v8/commands/npm-prefix |
| 12 | - /cli-documentation/v8/commands/prefix |
| 13 | - /cli-documentation/v8/npm-prefix |
| 14 | - /cli-documentation/v8/prefix |
| 15 | - /cli/v8/cli-commands/npm-prefix |
| 16 | - /cli/v8/cli-commands/prefix |
| 17 | - /cli/v8/commands/prefix |
| 18 | - /cli/v8/npm-prefix |
| 19 | - /cli/v8/prefix |
| 20 | --- |
| 21 | |
| 22 | ### Synopsis |
| 23 | |
| 24 | ```bash |
| 25 | npm prefix [-g] |
| 26 | ``` |
| 27 | |
| 28 | Note: This command is unaware of workspaces. |
| 29 | |
| 30 | ### Description |
| 31 | |
| 32 | Print the local prefix to standard output. This is the closest parent directory to contain a `package.json` file or `node_modules` directory, unless `-g` is also specified. |
| 33 | |
| 34 | If `-g` is specified, this will be the value of the global prefix. See [`npm config`](/cli/v8/commands/npm-config) for more detail. |
| 35 | |
| 36 | ### Example |
| 37 | |
| 38 | ```bash |
| 39 | npm prefix |
| 40 | /usr/local/projects/foo |
| 41 | ``` |
| 42 | |
| 43 | ```bash |
| 44 | npm prefix -g |
| 45 | /usr/local |
| 46 | ``` |
| 47 | |
| 48 | ### Configuration |
| 49 | |
| 50 | #### `global` |
| 51 | |
| 52 | - Default: false |
| 53 | - Type: Boolean |
| 54 | |
| 55 | Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See [folders](/cli/v8/configuring-npm/folders) for more on the differences in behavior. |
| 56 | |
| 57 | - packages are installed into the `{prefix}/lib/node_modules` folder, instead of the current working directory. |
| 58 | - bin files are linked to `{prefix}/bin` |
| 59 | - man pages are linked to `{prefix}/share/man` |
| 60 | |
| 61 | ### See Also |
| 62 | |
| 63 | - [npm root](/cli/v8/commands/npm-root) |
| 64 | - [npm bin](/cli/v8/commands/npm-bin) |
| 65 | - [npm folders](/cli/v8/configuring-npm/folders) |
| 66 | - [npm config](/cli/v8/commands/npm-config) |
| 67 | - [npmrc](/cli/v8/configuring-npm/npmrc) |