Сложность установки Angular CLI на Mac - PullRequest
0 голосов
/ 23 сентября 2019

Я пытаюсь установить angular в глобальный каталог моего Mac, но мне не повезло после нескольких попыток.Я опробовал следующий список ниже:

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

Как обновить Angular CLI до последней версии

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

Невозможно установить Angular CLI

Вот ошибка ...

> @angular/cli@8.3.5 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/cli@8.3.5 postinstall: `node ./bin/postinstall/script.js`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the @angular/cli@8.3.5 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

Пожалуйста, я буду признателен за любые предложения о том, как мне лучше всего подойти к этой проблеме?

Ответы [ 2 ]

0 голосов
/ 23 сентября 2019

Попробуйте обновить версию Node и NPM до последней версии.Angular 8 требуется Node 8.9+ и NPM 5.5.1 +.

0 голосов
/ 23 сентября 2019

попробуй с

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