Errors installing on MacOS


#1

I already have Cordova installed and don’t want to modify my current Cordova installation.

I just want to install iconic since I need that.

When I run npm install -g iconic I get the following errors:

npm WARN deprecated wrench@1.5.9: wrench.js is deprecated! You should check out fs-extra (https://github.com/jprichardson/node-fs-extra) for any operations you were using wrench for. Thanks for all the usage over the years.

> fsevents@1.1.2 install /usr/local/lib/node_modules/iconic/node_modules/fsevents
> node install

[fsevents] Success: "/usr/local/lib/node_modules/iconic/node_modules/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> librsvg@0.7.0 install /usr/local/lib/node_modules/iconic/node_modules/librsvg
> node-gyp rebuild

/bin/sh: pkg-config: command not found
gyp: Call to 'PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig pkg-config --libs-only-l librsvg-2.0 cairo-png cairo-pdf cairo-svg' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/iconic/node_modules/librsvg
gyp ERR! node -v v6.2.0
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok 
/usr/local/lib
└── (empty)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! librsvg@0.7.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the librsvg@0.7.0 install 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/admin/.npm/_logs/2017-10-29T02_24_28_915Z-debug.log

I am at a loss on how to get past this and get iconic loaded onto my system.

Any help would be greatly appreciated.


#2

I solved the problem with this – https://medium.com/@gge/how-to-install-ionic-on-mac-without-issues-3efe92a0da93

Installation
1- Open a new command line window. Type in:
sudo npm install --global --unsafe-perm quickscrape
And hit enter.

Mac: You will need to type in your computer password on all commands beginning with ‘sudo’

Windows: Remove the ‘sudo’ on all commands

2- Then type in:
sudo npm install -g cordova ionic --unsafe-perm quickscrape
And hit enter.

3- Finally type in:
sudo npm install -g ionic --unsafe-perm node-sass
And hit enter.

Ionic should be installed now.

And yes – it was installed successfully using that method! w00t!


#3

One solution: Uninstall your node, install nvm (or nvm-windows if you are on Windows), install a new node (which includes npm) with this, then install ionic and cordova again and try your command again. The problem should be gone.