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 exam‐
24 ple, 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
30 the 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 Multiple fields may be specified, and will be printed one after an‐
54 other. For example, to get all the contributor names and email ad‐
55 dresses, you can do this:
56
57 npm view express contributors.name contributors.email
58
59 "Person" fields are shown as a string if they would be shown as an ob‐
60 ject. So, for example, this will show the list of npm contributors in
61 the shortened string format. (See npm help package.json for more on
62 this.)
63
64 npm view npm contributors
65
66 If a version range is provided, then data will be printed for every
67 matching version of the package. This will show which version of jsdom
68 was required by each matching version of yui3:
69
70 npm view yui3@'>0.5.4' dependencies.jsdom
71
72 To show the connect package version history, you can do this:
73
74 npm view connect versions
75
76 Configuration
77 json
78 • Default: false
79
80 • Type: Boolean
81
82
83 Whether or not to output JSON data, rather than the normal output.
84
85 • In npm pkg set it enables parsing set values with JSON.parse() before
86 saving them to your package.json.
87
88
89 Not supported by all npm commands.
90
91 workspace
92 • Default:
93
94 • Type: String (can be set multiple times)
95
96
97 Enable running a command in the context of the configured workspaces of
98 the current project while filtering by running only the workspaces de‐
99 fined by this configuration option.
100
101 Valid values for the workspace config are either:
102
103 • Workspace names
104
105 • Path to a workspace directory
106
107 • Path to a parent workspace directory (will result in selecting all
108 workspaces within that folder)
109
110
111 When set for the npm init command, this may be set to the folder of a
112 workspace which does not yet exist, to create the folder and set it up
113 as a brand new workspace within the project.
114
115 This value is not exported to the environment for child processes.
116
117 workspaces
118 • Default: null
119
120 • Type: null or Boolean
121
122
123 Set to true to run the command in the context of all configured
124 workspaces.
125
126 Explicitly setting this to false will cause commands like install to
127 ignore workspaces altogether. When not set explicitly:
128
129 • Commands that operate on the node_modules tree (install, update,
130 etc.) will link workspaces into the node_modules folder. - Commands
131 that do other things (test, exec, publish, etc.) will operate on the
132 root project, unless one or more workspaces are specified in the
133 workspace config.
134
135
136 This value is not exported to the environment for child processes.
137
138 include-workspace-root
139 • Default: false
140
141 • Type: Boolean
142
143
144 Include the workspace root when workspaces are enabled for a command.
145
146 When false, specifying individual workspaces via the workspace config,
147 or all workspaces via the workspaces flag, will cause npm to operate
148 only on the specified workspaces, and not on the root project.
149
150 This value is not exported to the environment for child processes.
151
152 Output
153 If only a single string field for a single version is output, then it
154 will not be colorized or quoted, to enable piping the output to another
155 command. If the field is an object, it will be output as a JavaScript
156 object literal.
157
158 If the --json flag is given, the outputted fields will be JSON.
159
160 If the version range matches multiple versions then each printed value
161 will be prefixed with the version it applies to.
162
163 If multiple fields are requested, then each of them is prefixed with
164 the field name.
165
166 See Also
167 • npm help package spec
168
169 • npm help search
170
171 • npm help registry
172
173 • npm help config
174
175 • npm help npmrc
176
177 • npm help docs
178
179
180
181
182 September 2022 NPM-VIEW(1)