Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

531
Views
npm gives a TypeError every time I run it

I am trying to install a package using npm but no matter what I type in the console it just gives me errors.

I have version 16.6.2 of Node.js installed through the executable file from the website. I have tried reinstalling and repairing using the executable but it hasn't changed anything. I have also restarted my computer after reinstalling. It doesn't matter if I include any arguments after npm. Just typing npm and hitting enter will send these errors.

Node still runs just fine and will run the code I tell it to. It just seems to be npm that is broken.

TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\socks-proxy-agent\dist\agent.js:114:44)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\socks-proxy-agent\dist\index.js:5:33)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\lib\agent.js:161:25)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\socks-proxy-agent\dist\agent.js:114:44)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\socks-proxy-agent\dist\index.js:5:33)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\lib\agent.js:161:25)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

I have it figured out. Something must have gotten corrupted during the installation. I downloaded a new installation executable. I removed nodejs and then I deleted the folder from my program files and reinstalled. That fixed it. I should have tried this earlier but I didn't think about how there still might be files behind.

If you have this problem, uninstall using the installation file then go to your program files and delete the nodejs folder and then reinstall.

over 4 years ago · Santiago Trujillo Report

0

I had the same problem. Check if all old files in the nodejs folder after 'uninstall' are deleted!! This must work!

over 4 years ago · Santiago Trujillo Report

0

I just installed the last LTS version of Node.JS (16.13.1, npm 8.1.2) and got the same problem. And I figured out too in my own way by running this in cmd:

CD /D "C:\Program Files\nodejs\node_modules\npm\node_modules"
RMDIR /S /Q "%CD%\socks-proxy-agent\dist\"
npm --global --force install socks-proxy-agent@6.1.1
node --trace-deprecation socks-proxy-agent

After this, got some deprecation warnings, but npm starts works.

To view more info about warnings, run this:

CD /D "C:\Program Files\nodejs\node_modules\npm\node_modules"
node --trace-deprecation socks-proxy-agent
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!