Ly.O
Ly.O

Reputation: 41

Difficulty installing Angular CLI on Mac

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:

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 ?

Upvotes: 1

Views: 854

Answers (2)

MiLL10N
MiLL10N

Reputation: 1

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

Upvotes: 0

Adrian Zelada Torrez
Adrian Zelada Torrez

Reputation: 92

try with

sudo npm install -g @angular/cli --unsafe-perm=true --allow-root

Upvotes: 1

Related Questions