You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Failed to install any package with ERROR Code"npm ERR! Cannot read property 'insert' of undefined" #4876
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/npmrcglobalignorefile = "/etc/npmignore"; prefix = "/usr/local" ; overridden by project; "user" config from /home/yltx/.npmrchttps-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/.npmrcprefix = "/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.
I got this error after clearing cache trying to fix the stuck sill idealTree buildDeps issue. I ended up doing npm cache clear --force then setting npm config set registry http://registry.npmjs.org giving me this error.
@itchenfei's response helped. Changing the URL scheme from http to https did the trick.
when i update node version to v18.12.1 and npm still is v8.5.1, problem solved
I am using Ubuntu 22, I have used these versions using these commands so it worked for me:
sudo apt remove -y nodejs npm
sudo apt autoremove -y
sudo apt update
Activity
yltx commentedon May 10, 2022
OK it has been fixed.
weironz commentedon Jul 5, 2022
run follow for china
Xiamu-ssr commentedon Dec 17, 2022
when i update node version to v18.12.1 and npm still is v8.5.1, problem solved
itchenfei commentedon May 7, 2023
i got this error when set registry to http://registry.npmmirror.com
but actually registry is https://registry.npmmirror.com
so:
npm cache clear --force npm config set registry https://registry.npmmirror.comis the best answer
dhruvdey0907 commentedon May 25, 2023
npm ERR! Cannot read property 'insert' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-05-25T07_14_35_384Z-debug-0.log
why am i getting this
siblount commentedon Feb 15, 2024
I got this error after clearing cache trying to fix the stuck
sill idealTree buildDepsissue. I ended up doingnpm cache clear --forcethen settingnpm config set registry http://registry.npmjs.orggiving me this error.@itchenfei's response helped. Changing the URL scheme from http to https did the trick.
Hassanzamir47 commentedon Dec 20, 2024
I am using Ubuntu 22, I have used these versions using these commands so it worked for me:
sudo apt remove -y nodejs npm
sudo apt autoremove -y
sudo apt update
sudo apt install -y curl
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
node -v
Should output: v18.12.1
sudo npm install -g npm@8.5.1