Ng serve - Error: Cannot find module 'extend'

Hi there!
I’ve installed the angular in my mac. But when I run command (ng -v) or (ng serve) I am getting this error:

Unknown error: Error: Cannot find module 'extend'
Require stack:
- /usr/local/lib/node_modules/@angular/cli/node_modules/request/index.js
- /usr/local/lib/node_modules/@angular/cli/node_modules/universal-analytics/lib/index.js
- /usr/local/lib/node_modules/@angular/cli/node_modules/universal-analytics/index.js
- /usr/local/lib/node_modules/@angular/cli/models/analytics.js
- /usr/local/lib/node_modules/@angular/cli/models/command-runner.js
- /usr/local/lib/node_modules/@angular/cli/lib/cli/index.js
- /usr/local/lib/node_modules/@angular/cli/lib/init.js
- /usr/local/lib/node_modules/@angular/cli/bin/ng

However I’ve reinstalled the npm and tried every possible way but all in vain.
Seeking help!

I have moved your thread as this doesn’t sound like a support question related to the freeCodeCamp platform.


Did you try reinstalling Node.js?

What do running node -v and npm -v in the terminal give you back?

Yes, I’ve reinstalled the node and also the npm too.
Node -v: v12.22.12
Npm -v: 6.14.16

Hello

you are running an ancient version of Node that has reached end-of-life this year (no more support)

Upgrade to Node 18 and see if the problems return.

Yes, you’re right!
Actually my mac version is 10.13
And in 10.13 the version 14 don’t even install.
That’s why I can’t install the node latest version. Seeking to install angular within this node version.

Sorry to hear that, then you will keep running into this problem until you have upgraded your hardware.

Even Node themselves urge their users not to use anything below Node 16.

1 Like

Maybe using n or Homebrew might work.

I remember doing a binary install on Windows 7 when they stopped supporting it. Might work on Mac as well. You have to unzip it and set some environment variables. I can’t really find a guide for Mac.


Another option would be to use an online environment like StackBlitz or CodeSandbox.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.