Netlify-cli installation error code 1 windows

I’m new to netlify and I’m struggling with the netlify-cli installation as it does the same error everytime.

The commands I tried are :
npm install -g netlify-cli
npm install --save-dev netlify-cli
npx netlify-cli
npm cache clean --force

I’m running windows 11
My node version when I run node -v is v20.6.0
My npm version when I run npm -v is 10.5.0

the error is :
npm ERR! code 1
npm ERR! path C:\Users\name\AppData\Roaming\npm\node_modules\netlify-cli
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node ./scripts/postinstall.js
npm ERR! C:\Users\name\AppData\Roaming\npm\node_modules\netlify-cli\node_modules@babel\types\lib\index.js:65
npm ERR! Object.defineProperty(exports, “__internal__deprecationWarning”, {
npm ERR! ^
npm ERR!
npm ERR! TypeError: Cannot redefine property: __internal__deprecationWarning
npm ERR! at Function.defineProperty ()
npm ERR! at Object. (C:\Users\name\AppData\Roaming\npm\node_modules\netlify-cli\node_modules@babel\types\lib\index.js:65:8)
npm ERR! at Module._compile (node:internal/modules/cjs/loader:1241:14)
npm ERR! at Module._extensions…js (node:internal/modules/cjs/loader:1295:10)
npm ERR! at Module.load (node:internal/modules/cjs/loader:1091:32)
npm ERR! at Module._load (node:internal/modules/cjs/loader:938:12)
npm ERR! at Module.require (node:internal/modules/cjs/loader:1115:19)
npm ERR! at require (node:internal/modules/helpers:130:18)
npm ERR! at Object. (C:\Users\name\AppData\Roaming\npm\node_modules\netlify-cli\node_modules@babel\types\lib\builders\validateNode.js:8:14)
npm ERR! at Module._compile (node:internal/modules/cjs/loader:1241:14)
npm ERR!
npm ERR! Node.js v20.6.0

npm ERR! A complete log of this run can be found in: C:\Users\name\AppData\Local\npm-cache_logs\2024-03-13T18_33_35_726Z-debug-0.log

Really appreciate any kind of help, tell me if you need any more information

hi @FH-DEV1,

Can you update your node version to the latest LTS (or revert back to an older version if you prefer) and try again? From what I can see, there was a bug in version 20.6 that caused this error for various frameworks.

example in babel
example issue opened in node’s repo

Update your node version and reinstall your packages and things should clear up.