EACCES Permission denied & other errors building & emulating iOS with ionic 2 app


#1

I have tried everything in order to build and emulate ios. Xcode is up to date and installed on my computer.

This is what I’ve tried so far:

  1. reinstalling npm
  2. ionic hooks add​
  3. sudo removing ios
  4. sudo adding ios (got errors when trying to emulate and build)
  5. Sudo removing ios
  6. Adding ios without sudo (still errors trying to emulate and build)
  7. npm install -g ios-sim
  8. chown -R username .config/, files belong to me or root​

I have followed the other posts on this and nothing is working, please help! Also it says IOS platform isn’t installed when it definetly is.

I also don’t understand how to unlink ‘/Users/sh/Desktop/RT/www/build/app.html’?

Command line errors (exact same for build and emulate):

Running ‘emulate:before’ gulp task before emulate
[23:12:45] Starting ‘clean’…
[23:12:45] ‘clean’ errored after 36 ms
[23:12:45] Error: EACCES: permission denied, unlink '/Users/sh/Desktop/RT/www/build/app.html’
at Error (native)
• You’re trying to build for ios, but don’t have the platform installed yet.
∆ Installing ios for you.
√ Installed platform ios
Installing cordova-plugin-device
Installing cordova-plugin-console
Installing cordova-plugin-whitelist
Installing cordova-plugin-splashscreen
Installing cordova-plugin-statusbar
Installing ionic-plugin-keyboard
An Error occurred trying to fall back to Cordova-lib execution: TypeError: Cannot read property ‘then’ of undefined
at Object.IonicTask.runCordova (/usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:261:21)
at /usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:127:19
at _fulfilled (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:749:13)
at /usr/local/lib/node_modules/ionic/node_modules/q/q.js:557:44
at flush (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:108:17)
at doNTCallback0 (node.js:419:9)
at process._tickCallback (node.js:348:13)
Error happened TypeError: Cannot read property ‘then’ of undefined
at Object.IonicTask.runCordova (/usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:261:21)
at /usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:127:19
at _fulfilled (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:749:13)
at /usr/local/lib/node_modules/ionic/node_modules/q/q.js:557:44
at flush (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:108:17)
at doNTCallback0 (node.js:419:9)
at process._tickCallback (node.js:348:13)
TypeError: Cannot read property ‘then’ of undefined
at Object.IonicTask.runCordova (/usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:261:21)
at /usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:127:19
at _fulfilled (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:749:13)
at /usr/local/lib/node_modules/ionic/node_modules/q/q.js:557:44
at flush (/usr/local/lib/node_modules/ionic/node_modules/q/q.js:108:17)
at doNTCallback0 (node.js:419:9)
at process._tickCallback (node.js:348:13)


#2

This fixed it:

sudo chown -R username /Users/username/folder

This allowed it to emulate:

sudo npm install -g cordova (again)


#3

fixed. thanks