codekingpro/portable-devtools
114k
1.TH "NPM-VIEW" "1" "April 2026" "NPM@11.13.0" ""
2.SH "NAME"
3\fBnpm-view\fR - View registry info
4.SS "Synopsis"
5.P
6.RS 2
7.nf
8npm view \[lB]<package-spec>\[rB] \[lB]<field>\[lB].subfield\[rB]...\[rB]
9
10aliases: info, show, v
11.fi
12.RE
13.SS "Description"
14.P
15This command shows data about a package and prints it to stdout.
16.P
17As an example, to view information about the \fBconnect\fR package from the registry, you would run:
18.P
19.RS 2
20.nf
21npm view connect
22.fi
23.RE
24.P
25The default version is \fB"latest"\fR if unspecified.
26.P
27Field names can be specified after the package descriptor. For example, to show the dependencies of the \fBronn\fR package at version \fB0.3.5\fR, you could do the following:
28.P
29.RS 2
30.nf
31npm view ronn@0.3.5 dependencies
32.fi
33.RE
34.P
35By default, \fBnpm view\fR shows data about the current project context (by looking for a \fBpackage.json\fR). To show field data for the current project use a file path (i.e. \fB.\fR):
36.P
37.RS 2
38.nf
39npm view . dependencies
40.fi
41.RE
42.P
43You can view child fields by separating them with a period. To view the git repository URL for the latest version of \fBnpm\fR, you would run the following command:
44.P
45.RS 2
46.nf
47npm view npm repository.url
48.fi
49.RE
50.P
51This 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 \fBopts\fR that \fBronn\fR depends on, you could write the following:
52.P
53.RS 2
54.nf
55npm view opts@$(npm view ronn dependencies.opts)
56.fi
57.RE
58.P
59For 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 \fBexpress\fR package, you would run:
60.P
61.RS 2
62.nf
63npm view express contributors.email
64.fi
65.RE
66.P
67You 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:
68.P
69.RS 2
70.nf
71npm view express contributors\[lB]0\[rB].email
72.fi
73.RE
74.P
75If the field value you are querying for is a property of an object, you should run:
76.P
77.RS 2
78.nf
79npm view express time'\[lB]4.8.0\[rB]'
80.fi
81.RE
82.P
83Note: When accessing object properties that contain special characters or numeric keys, you need to use quotes around the key name. For example, to get the publish time of a specific version:
84.P
85.RS 2
86.nf
87npm view express "time\[lB]4.17.1\[rB]"
88.fi
89.RE
90.P
91Without quotes, the shell may interpret the square brackets as glob patterns, causing the command to fail. You can also access the time field for a specific version by specifying the version in the package descriptor:
92.P
93.RS 2
94.nf
95npm view express@4.17.1 time
96.fi
97.RE
98.P
99This will return all version-time pairs, but the context will be for that specific version.
100.P
101Multiple 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:
102.P
103.RS 2
104.nf
105npm view express contributors.name contributors.email
106.fi
107.RE
108.P
109"Person" fields are shown as a string if they would be shown as an object. So, for example, this will show the list of \fBnpm\fR contributors in the shortened string format. (See \fB\[rs]fBpackage.json\[rs]fR\fR \fI\(la/configuring-npm/package-json\(ra\fR for more on this.)
110.P
111.RS 2
112.nf
113npm view npm contributors
114.fi
115.RE
116.P
117If a version range is provided, then data will be printed for every matching version of the package. This will show which version of \fBjsdom\fR was required by each matching version of \fByui3\fR:
118.P
119.RS 2
120.nf
121npm view yui3@'>0.5.4' dependencies.jsdom
122.fi
123.RE
124.P
125To show the \fBconnect\fR package version history, you can do this:
126.P
127.RS 2
128.nf
129npm view connect versions
130.fi
131.RE
132.SS "Field Access Patterns"
133.P
134The \fBnpm view\fR command supports different ways to access nested fields and array elements in package metadata. Understanding these patterns makes it easier to extract specific information.
135.SS "Nested Object Fields"
136.P
137Use dot notation to access nested object fields:
138.P
139.RS 2
140.nf
141# Access nested properties
142npm view npm repository.url
143npm view express bugs.url
144.fi
145.RE
146.SS "Array Element Access"
147.P
148For arrays, use numeric indices in square brackets to access specific elements:
149.P
150.RS 2
151.nf
152# Get the first contributor's email
153npm view express contributors\[lB]0\[rB].email
154
155# Get the second maintainer's name
156npm view express maintainers\[lB]1\[rB].name
157.fi
158.RE
159.SS "Object Property Access"
160.P
161For object properties (like accessing specific versions in the \fBtime\fR field), use bracket notation with the property name in quotes:
162.P
163.RS 2
164.nf
165# Get publish time for a specific version
166npm view express "time\[lB]4.17.1\[rB]"
167
168# Get dist-tags
169npm view express "dist-tags.latest"
170.fi
171.RE
172.SS "Extracting Fields from Arrays"
173.P
174Request a non-numeric field on an array to get all values from objects in the list:
175.P
176.RS 2
177.nf
178# Get all contributor emails
179npm view express contributors.email
180
181# Get all contributor names
182npm view express contributors.name
183.fi
184.RE
185.SS "Configuration"
186.SS "\fBjson\fR"
187.RS 0
188.IP \(bu 4
189Default: false
190.IP \(bu 4
191Type: Boolean
192.RE 0
193
194.P
195Whether or not to output JSON data, rather than the normal output.
196.RS 0
197.IP \(bu 4
198In \fBnpm pkg set\fR it enables parsing set values with JSON.parse() before saving them to your \fBpackage.json\fR.
199.RE 0
200
201.P
202Not supported by all npm commands.
203.SS "\fBworkspace\fR"
204.RS 0
205.IP \(bu 4
206Default:
207.IP \(bu 4
208Type: String (can be set multiple times)
209.RE 0
210
211.P
212Enable 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.
213.P
214Valid values for the \fBworkspace\fR config are either:
215.RS 0
216.IP \(bu 4
217Workspace names
218.IP \(bu 4
219Path to a workspace directory
220.IP \(bu 4
221Path to a parent workspace directory (will result in selecting all workspaces within that folder)
222.RE 0
223
224.P
225When set for the \fBnpm init\fR 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.
226.P
227This value is not exported to the environment for child processes.
228.SS "\fBworkspaces\fR"
229.RS 0
230.IP \(bu 4
231Default: null
232.IP \(bu 4
233Type: null or Boolean
234.RE 0
235
236.P
237Set to true to run the command in the context of \fBall\fR configured workspaces.
238.P
239Explicitly setting this to false will cause commands like \fBinstall\fR to ignore workspaces altogether. When not set explicitly:
240.RS 0
241.IP \(bu 4
242Commands that operate on the \fBnode_modules\fR tree (install, update, etc.) will link workspaces into the \fBnode_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fIunless\fR one or more workspaces are specified in the \fBworkspace\fR config.
243.RE 0
244
245.P
246This value is not exported to the environment for child processes.
247.SS "\fBinclude-workspace-root\fR"
248.RS 0
249.IP \(bu 4
250Default: false
251.IP \(bu 4
252Type: Boolean
253.RE 0
254
255.P
256Include the workspace root when workspaces are enabled for a command.
257.P
258When false, specifying individual workspaces via the \fBworkspace\fR config, or all workspaces via the \fBworkspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project.
259.P
260This value is not exported to the environment for child processes.
261.SS "Output"
262.P
263If 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.
264.P
265If the \fB--json\fR flag is given, the outputted fields will be JSON.
266.P
267If the version range matches multiple versions then each printed value will be prefixed with the version it applies to.
268.P
269If multiple fields are requested, then each of them is prefixed with the field name.
270.SS "See Also"
271.RS 0
272.IP \(bu 4
273npm help "package spec"
274.IP \(bu 4
275npm help search
276.IP \(bu 4
277npm help registry
278.IP \(bu 4
279npm help config
280.IP \(bu 4
281npm help npmrc
282.IP \(bu 4
283npm help docs
284.RE 0
285 