npm / npm/cli

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

Open
#4,911 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage Release 8.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
This issue exists in the latest npm version
  • I am using the latest npm
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
  • npm: 8.5.5
  • node: v18.1.0
  • OS Name: Linux 5.17.7-arch1-2 GNU/Linux
  • System Model Name: n/a
  • npm config: -

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

The issue names no source file or test. First reproduce npm install with npm_config_cache set to a non-default location, then trace which install step creates ~/.npm. Done means the configured cache is used and no extra ~/.npm directory is created.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.