1

I am trying to install angular onto my Mac's global directory, but have had no luck so far after several attempts. I've tried out the following list below:

  • npm install -g @angular/cli
  • npm install -g @angular/cli@latest

How to upgrade Angular CLI to the latest version

https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

Can't install Angular CLI

Here is the error...

> @angular/[email protected] postinstall /Users/admin/Desktop/node_modules/@angular/cli
> node ./bin/postinstall/script.js
/Users/admin/Desktop/node_modules/@angular/cli/bin/postinstall/ng-update-message.js:7
const fs = require('fs');
^^^^^
SyntaxError: Use of const in strict mode.
 at Module._compile (module.js:439:25)
 at Object.Module._extensions..js (module.js:474:10)
 at Module.load (module.js:356:32)
 at Function.Module._load (module.js:312:12)
 at Module.require (module.js:364:17)
 at require (module.js:380:17)
 at Object.<anonymous> (/Users/admin/Desktop/node_modules/@angular/cli/bin/postinstall/script.js:4:1)
 at Module._compile (module.js:456:26)
 at Object.Module._extensions..js (module.js:474:10)
 at Module.load (module.js:356:32)
npm ERR! Darwin 16.7.0
npm ERR! argv "/Users/admin/.nvm/v0.10.48/bin/node" "/Users/admin/.nvm/v0.10.48/bin/npm" "install" "@angular/cli@latest"
npm ERR! node v0.10.48
npm ERR! npm v2.15.1
npm ERR! code ELIFECYCLE
npm ERR! @angular/[email protected] postinstall: `node ./bin/postinstall/script.js`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the @angular/[email protected] postinstall script 'node ./bin/postinstall/script.js'.
npm ERR! This is most likely a problem with the @angular/cli package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/postinstall/script.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs @angular/cli
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR! npm owner ls @angular/cli
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/admin/Desktop/npm-debug.log

Please, I'll appreciate any inputs on how I can best approach this issue ?

asked Sep 22, 2019 at 21:34
2
  • What's your node version? try after updating it. Commented Sep 23, 2019 at 3:00
  • 1
    I figured it out, thanks. I'm running on v10.16.3 Commented Sep 24, 2019 at 14:06

2 Answers 2

1

try with

sudo npm install -g @angular/cli --unsafe-perm=true --allow-root
answered Sep 23, 2019 at 2:50
Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for your input, I previously tried this command with no luck.
what is your version NodeJs ??
I've been able to resolve the issue. I originally installed NodeJs in :/usr/local/share/.npm incorrectly. I basically had to delete the .npm folder and reinstalled node and npm. Deleting the node_modules wasn't the easiest.
Thanks, I also made use of sudo npm install -g @angular/cli --unsafe-perm=true --allow-root . I'm running on v10.16.3
Thanks for this, this was the only command that worked for me.
0

Try to update your Node and NPM version to the latest. Angular 8 required Node 8.9+ and NPM 5.5.1+.

answered Sep 23, 2019 at 2:55

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.