codekingpro/portable-devtools
114k
1---
2title: npm-docs
3section: 1
4description: Open documentation for a package in a web browser
5---
6
7### Synopsis
8
9```bash
10npm docs [<pkgname> [<pkgname> ...]]
11
12alias: home
13```
14
15### Description
16
17This command tries to guess at the likely location of a package's documentation URL, and then tries to open it using the [`--browser` config](/using-npm/config#browser) param.
18You can pass multiple package names at once.
19If no package name is provided, it will search for a `package.json` in the current folder and use the `name` property.
20
21### Configuration
22
23#### `browser`
24
25* Default: macOS: `"open"`, Windows: `"start"`, Others: `"xdg-open"`
26* Type: null, Boolean, or String
27
28The browser that is called by npm commands to open websites.
29
30Set to `false` to suppress browser behavior and instead print urls to
31terminal.
32
33Set to `true` to use default system URL opener.
34
35
36
37#### `registry`
38
39* Default: "https://registry.npmjs.org/"
40* Type: URL
41
42The base URL of the npm registry.
43
44
45
46#### `workspace`
47
48* Default:
49* Type: String (can be set multiple times)
50
51Enable running a command in the context of the configured workspaces of the
52current project while filtering by running only the workspaces defined by
53this configuration option.
54
55Valid values for the `workspace` config are either:
56
57* Workspace names
58* Path to a workspace directory
59* Path to a parent workspace directory (will result in selecting all
60 workspaces within that folder)
61
62When set for the `npm init` command, this may be set to the folder of a
63workspace which does not yet exist, to create the folder and set it up as a
64brand new workspace within the project.
65
66This value is not exported to the environment for child processes.
67
68#### `workspaces`
69
70* Default: null
71* Type: null or Boolean
72
73Set to true to run the command in the context of **all** configured
74workspaces.
75
76Explicitly setting this to false will cause commands like `install` to
77ignore workspaces altogether. When not set explicitly:
78
79- Commands that operate on the `node_modules` tree (install, update, etc.)
80will link workspaces into the `node_modules` folder. - Commands that do
81other things (test, exec, publish, etc.) will operate on the root project,
82_unless_ one or more workspaces are specified in the `workspace` config.
83
84This value is not exported to the environment for child processes.
85
86#### `include-workspace-root`
87
88* Default: false
89* Type: Boolean
90
91Include the workspace root when workspaces are enabled for a command.
92
93When false, specifying individual workspaces via the `workspace` config, or
94all workspaces via the `workspaces` flag, will cause npm to operate only on
95the specified workspaces, and not on the root project.
96
97This value is not exported to the environment for child processes.
98
99### See Also
100
101* [npm view](/commands/npm-view)
102* [npm publish](/commands/npm-publish)
103* [npm registry](/using-npm/registry)
104* [npm config](/commands/npm-config)
105* [npmrc](/configuring-npm/npmrc)
106* [package.json](/configuring-npm/package-json)
107 