• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2title: npm-fund
3section: 1
4description: Retrieve funding information
5---
6
7### Synopsis
8
9```bash
10npm fund [<package-spec>]
11```
12
13### Description
14
15This command retrieves information on how to fund the dependencies of a
16given project. If no package name is provided, it will list all
17dependencies that are looking for funding in a tree structure, listing
18the type of funding and the url to visit. If a package name is provided
19then it tries to open its funding url using the
20[`--browser` config](/using-npm/config#browser) param; if there are multiple
21funding sources for the package, the user will be instructed to pass the
22`--which` option to disambiguate.
23
24The list will avoid duplicated entries and will stack all packages that
25share the same url as a single entry. Thus, the list does not have the
26same shape of the output from `npm ls`.
27
28#### Example
29
30### Workspaces support
31
32It's possible to filter the results to only include a single workspace
33and its dependencies using the
34[`workspace` config](/using-npm/config#workspace) option.
35
36#### Example:
37
38Here's an example running `npm fund` in a project with a configured
39workspace `a`:
40
41```bash
42$ npm fund
43test-workspaces-fund@1.0.0
44+-- https://example.com/a
45| | `-- a@1.0.0
46| `-- https://example.com/maintainer
47|     `-- foo@1.0.0
48+-- https://example.com/npmcli-funding
49|   `-- @npmcli/test-funding
50`-- https://example.com/org
51    `-- bar@2.0.0
52```
53
54And here is an example of the expected result when filtering only by a
55specific workspace `a` in the same project:
56
57```bash
58$ npm fund -w a
59test-workspaces-fund@1.0.0
60`-- https://example.com/a
61  | `-- a@1.0.0
62  `-- https://example.com/maintainer
63      `-- foo@2.0.0
64```
65
66### Configuration
67
68#### `json`
69
70* Default: false
71* Type: Boolean
72
73Whether or not to output JSON data, rather than the normal output.
74
75* In `npm pkg set` it enables parsing set values with JSON.parse() before
76  saving them to your `package.json`.
77
78Not supported by all npm commands.
79
80
81
82#### `browser`
83
84* Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"`
85* Type: null, Boolean, or String
86
87The browser that is called by npm commands to open websites.
88
89Set to `false` to suppress browser behavior and instead print urls to
90terminal.
91
92Set to `true` to use default system URL opener.
93
94
95
96#### `unicode`
97
98* Default: false on windows, true on mac/unix systems with a unicode locale,
99  as defined by the `LC_ALL`, `LC_CTYPE`, or `LANG` environment variables.
100* Type: Boolean
101
102When set to true, npm uses unicode characters in the tree output. When
103false, it uses ascii characters instead of unicode glyphs.
104
105
106
107#### `workspace`
108
109* Default:
110* Type: String (can be set multiple times)
111
112Enable running a command in the context of the configured workspaces of the
113current project while filtering by running only the workspaces defined by
114this configuration option.
115
116Valid 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
121  workspaces within that folder)
122
123When set for the `npm init` command, this may be set to the folder of a
124workspace which does not yet exist, to create the folder and set it up as a
125brand new workspace within the project.
126
127This value is not exported to the environment for child processes.
128
129#### `which`
130
131* Default: null
132* Type: null or Number
133
134If there are multiple funding sources, which 1-indexed source URL to open.
135
136
137
138## See Also
139
140* [package spec](/using-npm/package-spec)
141* [npm install](/commands/npm-install)
142* [npm docs](/commands/npm-docs)
143* [npm ls](/commands/npm-ls)
144* [npm config](/commands/npm-config)
145* [npm workspaces](/using-npm/workspaces)
146