npm Config, Auth & Cache

Configuration, npmrc, cache management, profile, and token workflows.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

npm configuration

Inspect and modify npm configuration.

List config values

Display effective npm configuration.

bashANYnpmconfig
bash
npm config list

Display effective npm configuration.

List all config defaults

Display defaults and computed values.

bashANYnpmconfig
bash
npm config ls -l

Display defaults and computed values.

Get a config value

Read a configuration value.

bashANYnpmconfig
bash
npm config get registry

Read a configuration value.

Set a config value

Write a configuration value.

bashANYnpmconfig
bash
npm config set registry https://registry.npmjs.org/

Write a configuration value.

Delete a config value

Remove a config setting.

bashANYnpmconfig
bash
npm config delete proxy

Remove a config setting.

Edit npmrc

Open the user npmrc in an editor.

bashANYnpmconfignpmrc
bash
npm config edit

Open the user npmrc in an editor.

Cache management

Inspect and clean npm cache.

Verify cache

Validate the integrity of the npm cache.

bashANYnpmcache
bash
npm cache verify

Validate the integrity of the npm cache.

Clean cache

Remove cached data. Force is required.

bashANYnpmcache
bash
npm cache clean --force

Remove cached data. Force is required.

Add package tarball to cache

Fetch a package into the local cache.

bashANYnpmcache
bash
npm cache add <package>

Fetch a package into the local cache.

Auth tokens and profile

Manage tokens and profile information.

List auth tokens

Show tokens for the current account.

bashANYnpmtokenauth
bash
npm token list

Show tokens for the current account.

Create auth token

Create a new auth token.

bashANYnpmtokenauth
bash
npm token create

Create a new auth token.

Revoke auth token

Delete an auth token.

bashANYnpmtokenauth
bash
npm token revoke <id>

Delete an auth token.

Get profile info

Read the current npm profile.

bashANYnpmprofile
bash
npm profile get

Read the current npm profile.

Set profile info

Update profile fields.

bashANYnpmprofile
bash
npm profile set fullname "Your Name"

Update profile fields.

Environment and paths

Helpful commands when debugging npm on a machine.

Show global prefix

Print the global installation prefix.

bashANYnpmglobalpaths
bash
npm prefix -g

Print the global installation prefix.

Show global node_modules root

Print the global node_modules directory.

bashANYnpmglobalpaths
bash
npm root -g

Print the global node_modules directory.

Show global bin path

Print the directory where global binaries are linked.

bashANYnpmglobalpaths
bash
npm bin -g

Print the directory where global binaries are linked.

Run npm environment checks

Check common npm environment problems.

bashANYnpmdoctor
bash
npm doctor

Check common npm environment problems.

Ping registry

Verify connectivity to the configured registry.

bashANYnpmping
bash
npm ping

Verify connectivity to the configured registry.

Recommended next

No recommendations yet.