dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
@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: latest |
| 7 | github_path: docs/lib/content/commands/npm-prefix.md |
| 8 | redirect_from: |
| 9 | - /cli-commands/npm-prefix |
| 10 | - /cli-commands/prefix |
| 11 | - /cli-documentation/cli-commands/npm-prefix |
| 12 | - /cli-documentation/cli-commands/prefix |
| 13 | - /cli-documentation/commands/npm-prefix |
| 14 | - /cli-documentation/commands/prefix |
| 15 | - /cli-documentation/npm-prefix |
| 16 | - /cli-documentation/prefix |
| 17 | - /cli-documentation/v11/cli-commands/npm-prefix |
| 18 | - /cli-documentation/v11/cli-commands/prefix |
| 19 | - /cli-documentation/v11/commands/npm-prefix |
| 20 | - /cli-documentation/v11/commands/prefix |
| 21 | - /cli-documentation/v11/npm-prefix |
| 22 | - /cli-documentation/v11/prefix |
| 23 | - /cli/cli-commands/npm-prefix |
| 24 | - /cli/cli-commands/prefix |
| 25 | - /cli/commands/npm-prefix |
| 26 | - /cli/commands/prefix |
| 27 | - /cli/npm-prefix |
| 28 | - /cli/prefix |
| 29 | - /cli/v11/cli-commands/npm-prefix |
| 30 | - /cli/v11/cli-commands/prefix |
| 31 | - /cli/v11/commands/prefix |
| 32 | - /cli/v11/npm-prefix |
| 33 | - /cli/v11/prefix |
| 34 | - /commands/npm-prefix |
| 35 | - /commands/prefix |
| 36 | --- |
| 37 | |
| 38 | ### Synopsis |
| 39 | |
| 40 | ```bash |
| 41 | npm prefix |
| 42 | ``` |
| 43 | |
| 44 | Note: This command is unaware of workspaces. |
| 45 | |
| 46 | ### Description |
| 47 | |
| 48 | 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. |
| 49 | |
| 50 | If `-g` is specified, this will be the value of the global prefix. See [`npm config`](/cli/v11/commands/npm-config) for more detail. |
| 51 | |
| 52 | ### Example |
| 53 | |
| 54 | ```bash |
| 55 | npm prefix |
| 56 | /usr/local/projects/foo |
| 57 | ``` |
| 58 | |
| 59 | ```bash |
| 60 | npm prefix -g |
| 61 | /usr/local |
| 62 | ``` |
| 63 | |
| 64 | ### Configuration |
| 65 | |
| 66 | #### `global` |
| 67 | |
| 68 | - Default: false |
| 69 | - Type: Boolean |
| 70 | |
| 71 | Operates in "global" mode, so that packages are installed into the `prefix` folder instead of the current working directory. See [folders](/cli/v11/configuring-npm/folders) for more on the differences in behavior. |
| 72 | |
| 73 | - packages are installed into the `{prefix}/lib/node_modules` folder, instead of the current working directory. |
| 74 | - bin files are linked to `{prefix}/bin` |
| 75 | - man pages are linked to `{prefix}/share/man` |
| 76 | |
| 77 | ### See Also |
| 78 | |
| 79 | - [npm root](/cli/v11/commands/npm-root) |
| 80 | - [npm folders](/cli/v11/configuring-npm/folders) |
| 81 | - [npm config](/cli/v11/commands/npm-config) |
| 82 | - [npmrc](/cli/v11/configuring-npm/npmrc) |