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