1 ---
2 title: npm-view
3 section: 1
4 description: View registry info
5 github_repo: npm/cli
6 github_branch: latest
7 github_path: docs/lib/content/commands/npm-view.md
8 redirect_from:
9 - /cli-commands/npm-view
10 - /cli-commands/view
11 - /cli-documentation/cli-commands/npm-view
12 - /cli-documentation/cli-commands/view
13 - /cli-documentation/commands/npm-view
14 - /cli-documentation/commands/view
15 - /cli-documentation/npm-view
16 - /cli-documentation/v10/cli-commands/npm-view
17 - /cli-documentation/v10/cli-commands/view
18 - /cli-documentation/v10/commands/npm-view
19 - /cli-documentation/v10/commands/view
20 - /cli-documentation/v10/npm-view
21 - /cli-documentation/v10/view
22 - /cli-documentation/view
23 - /cli/cli-commands/npm-view
24 - /cli/cli-commands/view
25 - /cli/commands/npm-view
26 - /cli/commands/view
27 - /cli/npm-view
28 - /cli/v10/cli-commands/npm-view
29 - /cli/v10/cli-commands/view
30 - /cli/v10/commands/view
31 - /cli/v10/npm-view
32 - /cli/v10/view
33 - /cli/view
34 - /commands/npm-view
35 - /commands/view
36 ---
37
38 ### Synopsis
39
40 ```bash
41 npm view [<package-spec>] [<field>[.subfield]...]
42
43 aliases: info, show, v
44 ```
45
46 ### Description
47
48 This command shows data about a package and prints it to stdout.
49
50 As an example, to view information about the `connect` package from the registry, you would run:
51
52 ```bash
53 npm view connect
54 ```
55
56 The default version is `"latest"` if unspecified.
57
58 Field names can be specified after the package descriptor. For example, to show the dependencies of the `ronn` package at version `0.3.5`, you could do the following:
59
60 ```bash
61 npm view ronn@0.3.5 dependencies
62 ```
63
64 By default, `npm view` shows data about the current project context (by looking for a `package.json`). To show field data for the current project use a file path (i.e. `.`):
65
66 ```bash
67 npm view . dependencies
68 ```
69
70 You can view child fields by separating them with a period. To view the git repository URL for the latest version of `npm`, you would run the following command:
71
72 ```bash
73 npm view npm repository.url
74 ```
75
76 This makes it easy to view information about a dependency with a bit of shell scripting. For example, to view all the data about the version of `opts` that `ronn` depends on, you could write the following:
77
78 ```bash
79 npm view opts@$(npm view ronn dependencies.opts)
80 ```
81
82 For fields that are arrays, requesting a non-numeric field will return all of the values from the objects in the list. For example, to get all the contributor email addresses for the `express` package, you would run:
83
84 ```bash
85 npm view express contributors.email
86 ```
87
88 You may also use numeric indices in square braces to specifically select an item in an array field. To just get the email address of the first contributor in the list, you can run:
89
90 ```bash
91 npm view express contributors[0].email
92 ```
93
94 If the field value you are querying for is a property of an object, you should run:
95
96 ```bash
97 npm view express time'[4.8.0]'
98 ```
99
100 Multiple fields may be specified, and will be printed one after another. For example, to get all the contributor names and email addresses, you can do this:
101
102 ```bash
103 npm view express contributors.name contributors.email
104 ```
105
106 "Person" fields are shown as a string if they would be shown as an object. So, for example, this will show the list of `npm` contributors in the shortened string format. (See [`package.json`](/cli/v10/configuring-npm/package-json) for more on this.)
107
108 ```bash
109 npm view npm contributors
110 ```
111
112 If a version range is provided, then data will be printed for every matching version of the package. This will show which version of `jsdom` was required by each matching version of `yui3`:
113
114 ```bash
115 npm view yui3@'>0.5.4' dependencies.jsdom
116 ```
117
118 To show the `connect` package version history, you can do this:
119
120 ```bash
121 npm view connect versions
122 ```
123
124 ### Configuration
125
126 #### `json`
127
128 - Default: false
129 - Type: Boolean
130
131 Whether or not to output JSON data, rather than the normal output.
132
133 - In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`.
134
135 Not supported by all npm commands.
136
137 #### `workspace`
138
139 - Default:
140 - Type: String (can be set multiple times)
141
142 Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option.
143
144 Valid values for the `workspace` config are either:
145
146 - Workspace names
147 - Path to a workspace directory
148 - Path to a parent workspace directory (will result in selecting all workspaces within that folder)
149
150 When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.
151
152 This value is not exported to the environment for child processes.
153
154 #### `workspaces`
155
156 - Default: null
157 - Type: null or Boolean
158
159 Set to true to run the command in the context of **all** configured workspaces.
160
161 Explicitly setting this to false will cause commands like `install` to ignore workspaces altogether. When not set explicitly:
162
163 - Commands that operate on the `node_modules` tree (install, update, etc.) will link workspaces into the `node_modules` folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, _unless_ one or more workspaces are specified in the `workspace` config.
164
165 This value is not exported to the environment for child processes.
166
167 #### `include-workspace-root`
168
169 - Default: false
170 - Type: Boolean
171
172 Include the workspace root when workspaces are enabled for a command.
173
174 When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project.
175
176 This value is not exported to the environment for child processes.
177
178 ### Output
179
180 If only a single string field for a single version is output, then it will not be colorized or quoted, to enable piping the output to another command. If the field is an object, it will be output as a JavaScript object literal.
181
182 If the `--json` flag is given, the outputted fields will be JSON.
183
184 If the version range matches multiple versions then each printed value will be prefixed with the version it applies to.
185
186 If multiple fields are requested, then each of them is prefixed with the field name.
187
188 ### See Also
189
190 - [package spec](/cli/v10/using-npm/package-spec)
191 - [npm search](/cli/v10/commands/npm-search)
192 - [npm registry](/cli/v10/using-npm/registry)
193 - [npm config](/cli/v10/commands/npm-config)
194 - [npmrc](/cli/v10/configuring-npm/npmrc)
195 - [npm docs](/cli/v10/commands/npm-docs)