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