11cb0ef41Sopenharmony_ci---
21cb0ef41Sopenharmony_cititle: npm-root
31cb0ef41Sopenharmony_cisection: 1
41cb0ef41Sopenharmony_cidescription: Display npm root
51cb0ef41Sopenharmony_ci---
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci### Synopsis
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci```bash
101cb0ef41Sopenharmony_cinpm root
111cb0ef41Sopenharmony_ci```
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciNote: This command is unaware of workspaces.
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ci### Description
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ciPrint the effective `node_modules` folder to standard out.
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ciUseful for using npm in shell scripts that do things with the
201cb0ef41Sopenharmony_ci`node_modules` folder.  For example:
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci```bash
231cb0ef41Sopenharmony_ci#!/bin/bash
241cb0ef41Sopenharmony_ciglobal_node_modules="$(npm root --global)"
251cb0ef41Sopenharmony_ciecho "Global packages installed in: ${global_node_modules}"
261cb0ef41Sopenharmony_ci```
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ci### Configuration
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci#### `global`
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci* Default: false
331cb0ef41Sopenharmony_ci* Type: Boolean
341cb0ef41Sopenharmony_ci
351cb0ef41Sopenharmony_ciOperates in "global" mode, so that packages are installed into the `prefix`
361cb0ef41Sopenharmony_cifolder instead of the current working directory. See
371cb0ef41Sopenharmony_ci[folders](/configuring-npm/folders) for more on the differences in behavior.
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ci* packages are installed into the `{prefix}/lib/node_modules` folder, instead
401cb0ef41Sopenharmony_ci  of the current working directory.
411cb0ef41Sopenharmony_ci* bin files are linked to `{prefix}/bin`
421cb0ef41Sopenharmony_ci* man pages are linked to `{prefix}/share/man`
431cb0ef41Sopenharmony_ci
441cb0ef41Sopenharmony_ci
451cb0ef41Sopenharmony_ci
461cb0ef41Sopenharmony_ci### See Also
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ci* [npm prefix](/commands/npm-prefix)
491cb0ef41Sopenharmony_ci* [npm folders](/configuring-npm/folders)
501cb0ef41Sopenharmony_ci* [npm config](/commands/npm-config)
511cb0ef41Sopenharmony_ci* [npmrc](/configuring-npm/npmrc)
52