npm / npm/cli

[BUG] install global typescript got error: npm ERR! ENOTEMPTY: directory not empty

Open
#4,096 9 comments 11 reactions 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
➜  create-config git:(feat/eslint-init) npm i typescript -g
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /Users/weiran/.npm-global/lib/node_modules/typescript
npm ERR! dest /Users/weiran/.npm-global/lib/node_modules/.typescript-ffKYZhoU
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/Users/weiran/.npm-global/lib/node_modules/typescript' -> '/Users/weiran/.npm-global/lib/node_modules/.typescript-ffKYZhoU'

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/weiran/.npm/_logs/2021-11-26T07_32_40_759Z-debug.log
Expected Behavior

global typescript installed without error.

Steps To Reproduce

No response

Environment
  • npm: 8.1.4
  • Node: v17.0.1
  • OS: macOS 12.1
  • platform:
  • npm config:
; copy and paste output from `npm config ls` here
; "user" config from /Users/weiran/.npmrc

//git.dian.so/api/v4/packages/npm/:_authToken = (protected) 
//npm.xiaodiankeji.net/:_authToken = (protected) 
//registry.npmjs.org/:_authToken = (protected) 
home = "https://npm.taobao.org" 
http-proxy = "http://127.0.0.1:8118" 
https-proxy = "http://127.0.0.1:8118/" 
init-author-name = "weiran" 
; package-lock = true ; overridden by project
prefix = "/Users/weiran/.npm-global" 
proxy = "http://127.0.0.1:8118/" 

; "project" config from /Users/weiran/repo/github/create-config/.npmrc

package-lock = false 

; node bin location = /usr/local/bin/node
; cwd = /Users/weiran/repo/github/create-config
; HOME = /Users/weiran
; Run `npm config ls -l` to show all defaults.

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

Start by reproducing npm i typescript -g with npm 8.1.4, Node v17.0.1, and the shown macOS prefix, then inspect the generated npm debug log and the ENOTEMPTY rename path. Done means global TypeScript installs successfully without the directory rename error.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.