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