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