1 ---
2 title: npm-view
3 section: 1
4 description: View registry info
5 github_repo: npm/cli
6 github_branch: release/v10
7 github_path: docs/lib/content/commands/npm-view.md
8 redirect_from:
9 - /cli-documentation/v10/cli-commands/npm-view
10 - /cli-documentation/v10/cli-commands/view
11 - /cli-documentation/v10/commands/npm-view
12 - /cli-documentation/v10/commands/view
13 - /cli-documentation/v10/npm-view
14 - /cli-documentation/v10/view
15 - /cli/v10/cli-commands/npm-view
16 - /cli/v10/cli-commands/view
17 - /cli/v10/commands/view
18 - /cli/v10/npm-view
19 - /cli/v10/view
20 ---
21
22 ### Synopsis
23
24 ```bash
25 npm view [<package-spec>] [<field>[.subfield]...]
26
27 aliases: info, show, v
28 ```
29
30 ### Description
31
32 This command shows data about a package and prints it to stdout.
33
34 As an example, to view information about the `connect` package from the registry, you would run:
35
36 ```bash
37 npm view connect
38 ```
39
40 The default version is `"latest"` if unspecified.
41
42 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:
43
44 ```bash
45 npm view ronn@0.3.5 dependencies
46 ```
47
48 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. `.`):
49
50 ```bash
51 npm view . dependencies
52 ```
53
54 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:
55
56 ```bash
57 npm view npm repository.url
58 ```
59
60 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:
61
62 ```bash
63 npm view opts@$(npm view ronn dependencies.opts)
64 ```
65
66 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:
67
68 ```bash
69 npm view express contributors.email
70 ```
71
72 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:
73
74 ```bash
75 npm view express contributors[0].email
76 ```
77
78 If the field value you are querying for is a property of an object, you should run:
79
80 ```bash
81 npm view express time'[4.8.0]'
82 ```
83
84 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:
85
86 ```bash
87 npm view express contributors.name contributors.email
88 ```
89
90 "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.)
91
92 ```bash
93 npm view npm contributors
94 ```
95
96 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`:
97
98 ```bash
99 npm view yui3@'>0.5.4' dependencies.jsdom
100 ```
101
102 To show the `connect` package version history, you can do this:
103
104 ```bash
105 npm view connect versions
106 ```
107
108 ### Configuration
109
110 #### `json`
111
112 - Default: false
113 - Type: Boolean
114
115 Whether or not to output JSON data, rather than the normal output.
116
117 - In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`.
118
119 Not supported by all npm commands.
120
121 #### `workspace`
122
123 - Default:
124 - Type: String (can be set multiple times)
125
126 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.
127
128 Valid values for the `workspace` config are either:
129
130 - Workspace names
131 - Path to a workspace directory
132 - Path to a parent workspace directory (will result in selecting all workspaces within that folder)
133
134 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.
135
136 This value is not exported to the environment for child processes.
137
138 #### `workspaces`
139
140 - Default: null
141 - Type: null or Boolean
142
143 Set to true to run the command in the context of **all** configured workspaces.
144
145 Explicitly setting this to false will cause commands like `install` to ignore workspaces altogether. When not set explicitly:
146
147 - 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.
148
149 This value is not exported to the environment for child processes.
150
151 #### `include-workspace-root`
152
153 - Default: false
154 - Type: Boolean
155
156 Include the workspace root when workspaces are enabled for a command.
157
158 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.
159
160 This value is not exported to the environment for child processes.
161
162 ### Output
163
164 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.
165
166 If the `--json` flag is given, the outputted fields will be JSON.
167
168 If the version range matches multiple versions then each printed value will be prefixed with the version it applies to.
169
170 If multiple fields are requested, then each of them is prefixed with the field name.
171
172 ### See Also
173
174 - [package spec](/cli/v10/using-npm/package-spec)
175 - [npm search](/cli/v10/commands/npm-search)
176 - [npm registry](/cli/v10/using-npm/registry)
177 - [npm config](/cli/v10/commands/npm-config)
178 - [npmrc](/cli/v10/configuring-npm/npmrc)
179 - [npm docs](/cli/v10/commands/npm-docs)