Ionic install issue osx

Hmm, I just ran sudo npm install ios-sim -g on my mac and it installed with out a problem.

So a few things to ask first. Do you have the xcode command line tool installed? You should be able to install it from Preferenced>Downloads.

Not sure what else could be causing the issues though.

Yep.
Bens-MacBook-Air:~ benraboine$ xcode-select --install
xcode-select: error: command line tools are already installed, use “Software Update” to install updates

Bens-MacBook-Air:myApp benraboine$ sudo npm install ios-sim -g
/

ios-sim@3.1.1 preinstall /usr/local/lib/node_modules/ios-sim
rake build

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rake/application.rb:50:in pwd': Permission denied - getcwd (Errno::EACCES) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rake/application.rb:50:in initialize’
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rake/rake_module.rb:10:in new' from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rake/rake_module.rb:10:in application’
from /usr/bin/rake:37:in `’

npm ERR! ios-sim@3.1.1 preinstall: rake build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ios-sim@3.1.1 preinstall script.
npm ERR! This is most likely a problem with the ios-sim package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! rake build
npm ERR! You can get their info via:
npm ERR! npm owner ls ios-sim
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 14.0.0
npm ERR! command “node” “/usr/local/bin/npm” “install” “ios-sim” “-g”
npm ERR! cwd /Users/benraboine/myApp
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

Can you try this?

$ DevToolsSecurity -enable

or

$ sudo DevToolsSecurity -enable

Seems to be a permissions issues, but I’m not really sure why

Do you have rvm installed?

Also, can you run rake --help?

I’m trying to figure out if you can access rake and ruby utils or its failing to have permissions to access those directories.

Bens-MacBook-Air:myApp benraboine$ sudo DevToolsSecurity -enable
Password:
Developer mode is already enabled.

Bens-MacBook-Air:myApp benraboine$ rake --help
rake [-f rakefile] {options} targets…

Options are …
–backtrace=[OUT] Enable full backtrace. OUT can be stderr (default) or stdout.
–comments Show commented tasks only
–job-stats [LEVEL] Display job statistics. LEVEL=history displays a complete job list
–reduce-compat Remove DSL in Object; remove Module#const_missing which defines ::Task etc.
–rules Trace the rules resolution.
–suppress-backtrace PATTERN Suppress backtrace lines matching regexp PATTERN. Ignored if --trace is on.
-A, --all Show all tasks, even uncommented ones
-C, --classic-namespace Put Task and FileTask in the top level namespace
-D, --describe [PATTERN] Describe the tasks (matching optional PATTERN), then exit.
-e, --execute CODE Execute some Ruby code and exit.
-E, --execute-continue CODE Execute some Ruby code, then continue with normal task processing.
-f, --rakefile [FILE] Use FILE as the rakefile.
-G, --no-system, --nosystem Use standard project Rakefile search paths, ignore system wide rakefiles.
-g, --system Using system wide (global) rakefiles (usually ‘~/.rake/*.rake’).
-I, --libdir LIBDIR Include LIBDIR in the search path for required modules.
-j, --jobs [NUMBER] Specifies the maximum number of tasks to execute in parallel. (default:2)
-m, --multitask Treat all tasks as multitasks.
-n, --dry-run Do a dry run without executing actions.
-N, --no-search, --nosearch Do not search parent directories for the Rakefile.
-P, --prereqs Display the tasks and dependencies, then exit.
-p, --execute-print CODE Execute some Ruby code, print the result, then exit.
-q, --quiet Do not log messages to standard output.
-r, --require MODULE Require MODULE before executing rakefile.
-R, --rakelibdir RAKELIBDIR, Auto-import any .rake files in RAKELIBDIR. (default is ‘rakelib’)
–rakelib
-s, --silent Like --quiet, but also suppresses the ‘in directory’ announcement.
-t, --trace=[OUT] Turn on invoke/execute tracing, enable full backtrace. OUT can be stderr (default) or stdout.
-T, --tasks [PATTERN] Display the tasks (matching optional PATTERN) with descriptions, then exit.
-v, --verbose Log message to standard output.
-V, --version Display the program version.
-W, --where [PATTERN] Describe the tasks (matching optional PATTERN), then exit.
-X, --no-deprecation-warnings Disable the deprecation warnings.
-h, -H, --help Display this help message.

I’m really excited to get started on this app. Any chance I can just stop by the office tomorrow with my laptop? Thanks, Ben

Nevermind, I am able to run it okay if I emulate the project from Xcode! Thanks for all your help with the previous issues.

raboine – are there any particular steps u can share about how you were able to get it working via running xCode first. I am unable to replicate this general step of running the Simulator through xCode first. Thanks. -Albert

I don’t recall because I never got it to work in command line, and it just worked when I tried it in xCode. I now use the browser testing with “ionic serve” then when I’m doing my final testing I use Ionic View on the actual device. Hope this helps!

I know it’s an old issue, but it’s still ranking high on google.

TLDR: Run the following:

sudo chown -R $USER /usr/local/

If you’ve used sudo to install npm you’ll run into this problem. Here’s the issue from github: https://github.com/npm/npm/issues/194

Hi, I have same problem of first message in this topic. I have OS X 10.10.5, i have repaired permission in utility and in recovery mode, using sudo doesn’t work the command

sudo npm install -g cordova ionic

all software needed are installed, in $PATH is present the directory usr/local/lib

Password:
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"4.2.0","npm":"2.14.7"})

> spawn-sync@1.0.13 postinstall /usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/cross-spawn/node_modules/spawn-sync
> node postinstall

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
path.js:424
    var path = (i >= 0) ? arguments[i] : process.cwd();
                                                 ^

Error: EACCES: permission denied, uv_cwd
    at Error (native)
    at Object.posix.resolve (path.js:424:50)
    at startup (node.js:93:32)
    at node.js:961:3
/usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova

> node-sass@3.3.3 install /usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/node-sass
> node scripts/install.js

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
path.js:424
    var path = (i >= 0) ? arguments[i] : process.cwd();
                                                 ^

Error: EACCES: permission denied, uv_cwd
    at Error (native)
    at Object.posix.resolve (path.js:424:50)
    at startup (node.js:93:32)
    at node.js:961:3
npm WARN engine cordova-js@4.0.0: wanted: {"node":"~0.10.x"} (current: {"node":"4.2.0","npm":"2.14.7"})
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"4.2.0","npm":"2.14.7"})
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova" "ionic"
npm ERR! node v4.2.0
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! spawn-sync@1.0.13 postinstall: `node postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spawn-sync@1.0.13 postinstall script 'node postinstall'.
npm ERR! This is most likely a problem with the spawn-sync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node postinstall
npm ERR! You can get their info via:
npm ERR!     npm owner ls spawn-sync
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/davideandreoli/npm-debug.log`

HELP ME!

I SOLVED

i needed to repair the permissions during install:

i launch this command

sudo npm install --global --unsafe-perm quickscrape

so it’s download a package and installed that fix problems, so the line “updated”

sudo npm install -g cordova ionic --unsafe-perm quickscrape

FINALLY INSTALLED SUCCESFULLY!

5 Likes

I am having the same issue and will try the same. Can others confirm this is the “correct” fix for this?

This did work for me, although have zero idea about what this “–unsafe-perm quickscrape” does actually.

This also worked for me. I was having trouble with the sass and spawn-sync modules, but this command worked.

1 Like

Thanks. I was also having issues with node-sass, solved it with:
sudo npm install -g ionic --unsafe-perm node-sass

Works great with this. Remember to also use what @Avilagab wrote at the end as well.

I published the complete solution here: https://medium.com/@gautham.gg/how-to-install-ionic-on-mac-without-issues-3efe92a0da93#.yh5zsay13

So if you are having issues you might wanna check it out.

Prerequisite: npm must be installed. You can check this by entering this command: ‘npm -v’. This should give you the version number. If not please install them.

Now lets fix the issue.

First launch this command:

sudo npm install --global --unsafe-perm quickscrape

Then, launch this command:

sudo npm install -g cordova ionic --unsafe-perm quickscrape

Now, run this command:

sudo npm install -g ionic --unsafe-perm node-sass

Once I did this, Ionic worked beautifully. This was done on a MacBook Pro (Retina, 13-inch, Late 2012), running OSX El Capitan 10.11.2.
I’m not sure if Windows users have any issues with this, but I believe that you should remove the ‘sudo’ if you are doing this on windows.

Now that you have followed my steps, both Ionic and Cordova should be installed, and working. Start by creating a blank Ionic project:

ionic start myApp blank

1 Like

HI EVERYBODY ,i have same problem in installing ionic.
i try install ionic2 on el capitan 10.11.1 when i try to install with this commandnpm install -g ionic cordova or any command that exist on this page unfortunately not work .
error that i Deal with it :

npm WARN deprecated node-uuid@1.4.7: use uuid module instead
npm ERR! Darwin 15.0.0
npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “install” “-g” “ionic” "cordova"
npm ERR! node v7.2.0
npm ERR! npm v3.10.9

npm ERR! Invalid name: "@ionic/app-generators"
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /Users/mohamad/npm-debug.log.

plz answer me quickly

Hi i have the same problem trying to install ionic on my mac

sudo npm -g install ionic
Error: EPERM: operation not permitted, mkdir '/usr/loca’
at Error (native)
npm -v
3.10.10
sudo npm install --global --unsafe-perm quickscrape
Error: EPERM: operation not permitted, mkdir '/usr/loca’
at Error (native)

Someone can help