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