Skip to content

[BUG] Failed to install any package with ERROR Code"npm ERR! Cannot read property 'insert' of undefined" #4876

Closed
@yltx

Description

@yltx

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

Why I don't use the latest version of npm:I even can't update npm by using "sudo npm i -g npm".

The environment information:

node version: v12.22.9

npm version: v8.5.1

WSL version:

Build: 22598

Release: Ubuntu 22.04 LTS

Kernel: Linux 5.10.102.1-microsoft-standard-WSL2

This problem also exists in these websites:

https://serveanswer.com/questions/npm-install-error-npm-err-cannot-read-property-insert-of-undefined

https://stackoverflow.com/questions/72004247/npm-install-error-npm-err-cannot-read-property-insert-of-undefined/72183748#72183748

They use the same version of node and npm as I , but I can't know if they are also using WSL too.

Expected Behavior

Install normally.

Steps To Reproduce

sudo npm i -g npm

Actually , whatever package I install , it fails with the same ERROR Code.

Environment

  • npm:8.5.1
  • Node.js:12.22.9
  • OS Name:WSL2
  • System Model Name:Windows Subsystem for Linux
  • npm config:
; "builtin" config from /usr/share/nodejs/npm/npmrc

globalignorefile = "/etc/npmignore"
; prefix = "/usr/local" ; overridden by project

; "user" config from /home/yltx/.npmrc

https-proxy = "http://172.31.160.1:10087/"
proxy = "http://172.31.160.1:10087/"
; registry = "https://registry.npmmirror.com/" ; overridden by project

; "project" config from /mnt/c/Users/yltx/.npmrc

prefix = "/mnt/c/Users/yltx/C:\\Windows\\System32"
registry = "https://registry.npmmirror.com/"

; node bin location = /usr/bin/node
; cwd = /mnt/c/Users/yltx
; HOME = /home/yltx
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions