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