'Error: Cannot find module '/root/.nvm/versions/node/v17.4.0/lib/node_modules/@angular/cli/bin/postinstall/script.js'

I can't install the angular cli with npm install -g @angular/cli in the ubuntu 20.04.3 LTS.

node version:- v17.4.0, npm version:- 8.6.0

.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path /root/.nvm/versions/node/v17.4.0/lib/node_modules/@angular/cli
npm ERR! command failed
npm ERR! command sh -c node ./bin/postinstall/script.js
npm ERR! internal/modules/cjs/loader.js:638
npm ERR!     throw err;
npm ERR!     ^
npm ERR! 
npm ERR! Error: Cannot find module '/root/.nvm/versions/node/v17.4.0/lib/node_modules/@angular/cli/bin/postinstall/script.js'
npm ERR!     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
npm ERR!     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
npm ERR!     at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
npm ERR!     at startup (internal/bootstrap/node.js:283:19)
npm ERR!     at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-04-04T10_45_11_959Z-debug-0.log


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source