11cb0ef41Sopenharmony_ci---
21cb0ef41Sopenharmony_cititle: npm-fund
31cb0ef41Sopenharmony_cisection: 1
41cb0ef41Sopenharmony_cidescription: Retrieve funding information
51cb0ef41Sopenharmony_ci---
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci### Synopsis
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci```bash
101cb0ef41Sopenharmony_cinpm fund [<package-spec>]
111cb0ef41Sopenharmony_ci```
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ci### Description
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ciThis command retrieves information on how to fund the dependencies of a
161cb0ef41Sopenharmony_cigiven project. If no package name is provided, it will list all
171cb0ef41Sopenharmony_cidependencies that are looking for funding in a tree structure, listing
181cb0ef41Sopenharmony_cithe type of funding and the url to visit. If a package name is provided
191cb0ef41Sopenharmony_cithen it tries to open its funding url using the
201cb0ef41Sopenharmony_ci[`--browser` config](/using-npm/config#browser) param; if there are multiple
211cb0ef41Sopenharmony_cifunding sources for the package, the user will be instructed to pass the
221cb0ef41Sopenharmony_ci`--which` option to disambiguate.
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ciThe list will avoid duplicated entries and will stack all packages that
251cb0ef41Sopenharmony_cishare the same url as a single entry. Thus, the list does not have the
261cb0ef41Sopenharmony_cisame shape of the output from `npm ls`.
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ci#### Example
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci### Workspaces support
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ciIt's possible to filter the results to only include a single workspace
331cb0ef41Sopenharmony_ciand its dependencies using the
341cb0ef41Sopenharmony_ci[`workspace` config](/using-npm/config#workspace) option.
351cb0ef41Sopenharmony_ci
361cb0ef41Sopenharmony_ci#### Example:
371cb0ef41Sopenharmony_ci
381cb0ef41Sopenharmony_ciHere's an example running `npm fund` in a project with a configured
391cb0ef41Sopenharmony_ciworkspace `a`:
401cb0ef41Sopenharmony_ci
411cb0ef41Sopenharmony_ci```bash
421cb0ef41Sopenharmony_ci$ npm fund
431cb0ef41Sopenharmony_citest-workspaces-fund@1.0.0
441cb0ef41Sopenharmony_ci+-- https://example.com/a
451cb0ef41Sopenharmony_ci| | `-- a@1.0.0
461cb0ef41Sopenharmony_ci| `-- https://example.com/maintainer
471cb0ef41Sopenharmony_ci|     `-- foo@1.0.0
481cb0ef41Sopenharmony_ci+-- https://example.com/npmcli-funding
491cb0ef41Sopenharmony_ci|   `-- @npmcli/test-funding
501cb0ef41Sopenharmony_ci`-- https://example.com/org
511cb0ef41Sopenharmony_ci    `-- bar@2.0.0
521cb0ef41Sopenharmony_ci```
531cb0ef41Sopenharmony_ci
541cb0ef41Sopenharmony_ciAnd here is an example of the expected result when filtering only by a
551cb0ef41Sopenharmony_cispecific workspace `a` in the same project:
561cb0ef41Sopenharmony_ci
571cb0ef41Sopenharmony_ci```bash
581cb0ef41Sopenharmony_ci$ npm fund -w a
591cb0ef41Sopenharmony_citest-workspaces-fund@1.0.0
601cb0ef41Sopenharmony_ci`-- https://example.com/a
611cb0ef41Sopenharmony_ci  | `-- a@1.0.0
621cb0ef41Sopenharmony_ci  `-- https://example.com/maintainer
631cb0ef41Sopenharmony_ci      `-- foo@2.0.0
641cb0ef41Sopenharmony_ci```
651cb0ef41Sopenharmony_ci
661cb0ef41Sopenharmony_ci### Configuration
671cb0ef41Sopenharmony_ci
681cb0ef41Sopenharmony_ci#### `json`
691cb0ef41Sopenharmony_ci
701cb0ef41Sopenharmony_ci* Default: false
711cb0ef41Sopenharmony_ci* Type: Boolean
721cb0ef41Sopenharmony_ci
731cb0ef41Sopenharmony_ciWhether or not to output JSON data, rather than the normal output.
741cb0ef41Sopenharmony_ci
751cb0ef41Sopenharmony_ci* In `npm pkg set` it enables parsing set values with JSON.parse() before
761cb0ef41Sopenharmony_ci  saving them to your `package.json`.
771cb0ef41Sopenharmony_ci
781cb0ef41Sopenharmony_ciNot supported by all npm commands.
791cb0ef41Sopenharmony_ci
801cb0ef41Sopenharmony_ci
811cb0ef41Sopenharmony_ci
821cb0ef41Sopenharmony_ci#### `browser`
831cb0ef41Sopenharmony_ci
841cb0ef41Sopenharmony_ci* Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"`
851cb0ef41Sopenharmony_ci* Type: null, Boolean, or String
861cb0ef41Sopenharmony_ci
871cb0ef41Sopenharmony_ciThe browser that is called by npm commands to open websites.
881cb0ef41Sopenharmony_ci
891cb0ef41Sopenharmony_ciSet to `false` to suppress browser behavior and instead print urls to
901cb0ef41Sopenharmony_citerminal.
911cb0ef41Sopenharmony_ci
921cb0ef41Sopenharmony_ciSet to `true` to use default system URL opener.
931cb0ef41Sopenharmony_ci
941cb0ef41Sopenharmony_ci
951cb0ef41Sopenharmony_ci
961cb0ef41Sopenharmony_ci#### `unicode`
971cb0ef41Sopenharmony_ci
981cb0ef41Sopenharmony_ci* Default: false on windows, true on mac/unix systems with a unicode locale,
991cb0ef41Sopenharmony_ci  as defined by the `LC_ALL`, `LC_CTYPE`, or `LANG` environment variables.
1001cb0ef41Sopenharmony_ci* Type: Boolean
1011cb0ef41Sopenharmony_ci
1021cb0ef41Sopenharmony_ciWhen set to true, npm uses unicode characters in the tree output. When
1031cb0ef41Sopenharmony_cifalse, it uses ascii characters instead of unicode glyphs.
1041cb0ef41Sopenharmony_ci
1051cb0ef41Sopenharmony_ci
1061cb0ef41Sopenharmony_ci
1071cb0ef41Sopenharmony_ci#### `workspace`
1081cb0ef41Sopenharmony_ci
1091cb0ef41Sopenharmony_ci* Default:
1101cb0ef41Sopenharmony_ci* Type: String (can be set multiple times)
1111cb0ef41Sopenharmony_ci
1121cb0ef41Sopenharmony_ciEnable running a command in the context of the configured workspaces of the
1131cb0ef41Sopenharmony_cicurrent project while filtering by running only the workspaces defined by
1141cb0ef41Sopenharmony_cithis configuration option.
1151cb0ef41Sopenharmony_ci
1161cb0ef41Sopenharmony_ciValid values for the `workspace` config are either:
1171cb0ef41Sopenharmony_ci
1181cb0ef41Sopenharmony_ci* Workspace names
1191cb0ef41Sopenharmony_ci* Path to a workspace directory
1201cb0ef41Sopenharmony_ci* Path to a parent workspace directory (will result in selecting all
1211cb0ef41Sopenharmony_ci  workspaces within that folder)
1221cb0ef41Sopenharmony_ci
1231cb0ef41Sopenharmony_ciWhen set for the `npm init` command, this may be set to the folder of a
1241cb0ef41Sopenharmony_ciworkspace which does not yet exist, to create the folder and set it up as a
1251cb0ef41Sopenharmony_cibrand new workspace within the project.
1261cb0ef41Sopenharmony_ci
1271cb0ef41Sopenharmony_ciThis value is not exported to the environment for child processes.
1281cb0ef41Sopenharmony_ci
1291cb0ef41Sopenharmony_ci#### `which`
1301cb0ef41Sopenharmony_ci
1311cb0ef41Sopenharmony_ci* Default: null
1321cb0ef41Sopenharmony_ci* Type: null or Number
1331cb0ef41Sopenharmony_ci
1341cb0ef41Sopenharmony_ciIf there are multiple funding sources, which 1-indexed source URL to open.
1351cb0ef41Sopenharmony_ci
1361cb0ef41Sopenharmony_ci
1371cb0ef41Sopenharmony_ci
1381cb0ef41Sopenharmony_ci## See Also
1391cb0ef41Sopenharmony_ci
1401cb0ef41Sopenharmony_ci* [package spec](/using-npm/package-spec)
1411cb0ef41Sopenharmony_ci* [npm install](/commands/npm-install)
1421cb0ef41Sopenharmony_ci* [npm docs](/commands/npm-docs)
1431cb0ef41Sopenharmony_ci* [npm ls](/commands/npm-ls)
1441cb0ef41Sopenharmony_ci* [npm config](/commands/npm-config)
1451cb0ef41Sopenharmony_ci* [npm workspaces](/using-npm/workspaces)
146