npm / npm/cli

[BUG] Extra .npm directory created in user's home while npm_config_cache set

Open
#3,350 5 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Priority 2 Release 9.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
Current Behavior

A ~/.npm directory gets created on npm install along with the correct directory specified in npm_config_cache. On a fresh install without a cache created yet, the size of the extra ~/.npm directory is 2.1 MiB and the size of the specified ~/.cache/npm directory is 89.1 MiB.

Expected Behavior

Obey the npm_config_cache without creating the extra directory in home.

Steps To Reproduce

npm install a package while having npm_config_cache set to a location other than default. The extra directory is created at the end of install.

Environment

Originally:

Arch Linux
node v14.2.0
npm 6.14.5

Ongoing:

Arch Linux
node v16.2.0
npm 7.15.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue by running npm install with npm_config_cache set to a non-default location on the listed environment, then inspect the install's cache handling. Done means npm uses the configured cache and does not create an extra ~/.npm directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.