Search code examples
node.jsangularmacosmacos-high-sierra

Erron on installing angular on mac


I try to install Angular CLI on mac with following command

sudo npm install -g @angular/cli

The error shown as follows

/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng

> fsevents@1.2.4 install /usr/local/lib/node_modules/@angular/cli/node_modules/fsevents
> node install

sh: node: command not found

> @angular/cli@6.0.8 postinstall /usr/local/lib/node_modules/@angular/cli
> node ./bin/ng-update-message.js

sh: node: command not found
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/@angular/cli/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn ENOENT

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @angular/cli@6.0.8 postinstall: `node ./bin/ng-update-message.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the @angular/cli@6.0.8 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sugunan/.npm/_logs/2018-07-08T01_27_53_465Z-debug.log

How to fix the issue?


Solution

  • Following command worked

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