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
Notes

Display effective npm configuration.

List all config defaults

Display defaults and computed values.

bashANYnpmconfig
bash
npm config ls -l
Notes

Display defaults and computed values.

Get a config value

Read a configuration value.

bashANYnpmconfig
bash
npm config get registry
Notes

Read a configuration value.

Set a config value

Write a configuration value.

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

Write a configuration value.

Delete a config value

Remove a config setting.

bashANYnpmconfig
bash
npm config delete proxy
Notes

Remove a config setting.

Edit npmrc

Open the user npmrc in an editor.

bashANYnpmconfignpmrc
bash
npm config edit
Notes

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
Notes

Validate the integrity of the npm cache.

Clean cache

Remove cached data. Force is required.

bashANYnpmcache
bash
npm cache clean --force
Notes

Remove cached data. Force is required.

Add package tarball to cache

Fetch a package into the local cache.

bashANYnpmcache
bash
npm cache add <package>
Notes

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
Notes

Show tokens for the current account.

Create auth token

Create a new auth token.

bashANYnpmtokenauth
bash
npm token create
Notes

Create a new auth token.

Revoke auth token

Delete an auth token.

bashANYnpmtokenauth
bash
npm token revoke <id>
Notes

Delete an auth token.

Get profile info

Read the current npm profile.

bashANYnpmprofile
bash
npm profile get
Notes

Read the current npm profile.

Set profile info

Update profile fields.

bashANYnpmprofile
bash
npm profile set fullname "Your Name"
Notes

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
Notes

Print the global installation prefix.

Show global node_modules root

Print the global node_modules directory.

bashANYnpmglobalpaths
bash
npm root -g
Notes

Print the global node_modules directory.

Show global bin path

Print the directory where global binaries are linked.

bashANYnpmglobalpaths
bash
npm bin -g
Notes

Print the directory where global binaries are linked.

Run npm environment checks

Check common npm environment problems.

bashANYnpmdoctor
bash
npm doctor
Notes

Check common npm environment problems.

Ping registry

Verify connectivity to the configured registry.

bashANYnpmping
bash
npm ping
Notes

Verify connectivity to the configured registry.

Recommended next

No recommendations yet.