From 4b43656fc608783a29ccf8495dc305459abc5cc7 Mon Sep 17 00:00:00 2001 From: Michael Garvin Date: Fri, 8 Jan 2021 14:58:58 -0800 Subject: [PATCH] fix(docs): clean up `npm prefix` docs Adds an example and slightly changes wording PR-URL: https://github.com/npm/cli/pull/2463 Credit: @wraithgar Close: #2463 Reviewed-by: @darcyclarke --- docs/content/commands/npm-prefix.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/content/commands/npm-prefix.md b/docs/content/commands/npm-prefix.md index 6894cb5c9298c..9c33bb18901ef 100644 --- a/docs/content/commands/npm-prefix.md +++ b/docs/content/commands/npm-prefix.md @@ -12,13 +12,25 @@ npm prefix [-g] ### Description -Print the local prefix to standard out. This is the closest parent directory +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. If `-g` is specified, this will be the value of the global prefix. See [`npm config`](/commands/npm-config) for more detail. +### Example + +```bash +npm prefix +/usr/local/projects/foo +``` + +```bash +npm prefix -g +/usr/local +``` + ### See Also * [npm root](/commands/npm-root)