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