Can't add ios or android platform Mac OSX

Hi,
I’m currently trying to get started on the tutorials and it went fine until I tried to add platforms.

When ever I entered

ionic platform add ios

or:

ionic platform add android

in my terminal. I would always get an error like:

Error: ENOENT, no such file or directory '/Users/adeyo/todo/ionic-app-base-master/plugins/android.json'
at Error (native)
at Object.fs.openSync (fs.js:455:18)
at Object.fs.writeFileSync (fs.js:1001:15)
at Object.save_platform_json (/usr/local/etc/lib/node_modules/cordova/node_modules/cordova-    lib/src/plugman/util/config-changes.js:476:8)
at PlatformMunger_process [as process]   (/usr/local/etc/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config- changes.js:401:13)
at Object.exports.process (/usr/local/etc/lib/node_modules/cordova/node_modules/cordova-  lib/src/plugman/util/config-changes.js:80:12)
at Object.handlePrepare (/usr/local/etc/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/prepare.js:72:20)
at /usr/local/etc/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:102:25
at Array.map (native)
at /usr/local/etc/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:66:40

I really have no idea what the issue is.

Edit: I am using CLI v1.2.7 if that helps, Thanks.

Hi @adeyo92,

What directory are you trying to run these command from?

Hi @nicraboy
I am running them from the ionic-app-base-master directory in the todo folder

so it’s

/todo/ionic-app-base-master

Hi @adeyo92,

Just to confirm some things:

  1. How did you obtain the project? Did you run something like ionic start project blank? If you used a different method, I’m wondering if there were some missing files.
  2. What happens if you remove all the hyphens? I’ve found that hyphens and spaces cause all kinds of problems.

Let me know.

Hi @nicraboy

  1. yes I did run ionic start todo blank to setup the project.

  2. I removed the hyphens and the errors remained the same.

Thanks

Hi @adeyo92,

You are a directory too high. If you are creating a project called todo, you need to run ionic platform add ios from that directory, not ionic-app-base-master.

Let me know if that makes a difference.

Thanks,

Hi @nicraboy

I actually tried that. The thing is, I noticed that when Ionic creates the project, it places a folder called ionic-app-base-master which has all the necessary files and folders(www, hooks etc.) in the todo folder. If I try to run the command from the todo folder, I get an error saying:

Current working directory is not a Cordova-based project.

If I transfer the files to the todo folder, the ENOENT error returns.

Hi @adeyo92,

What version of Ionic CLI and Apache Cordova are you using?

@mhartington any ideas on this one?

Hi @nicraboy
cordova --v
3.6.3-0.2.13

CLI v1.2.7

Thanks

So this first error was just because there was no plugin folder, this can be resolved by making one

mkdir plugins

Something that people do miss their first time is they forget to cd into the newly created directory.

So you should do this.

$ ionic start tmp blank
$ cd tmp
$ ionic platform add ios
1 Like

Hi @mhartington,

I’ve never had an issue with a missing plugins directory on my Mac in a new project. Did something change?

Nothings changed, but from that error, that was the issue.

I think there was just an issue with the initial project setup

Edit: Followed the steps listed here

http://ionicframework.com/docs/guide/installation.html

And wasn’t able to reproduce the error

Oh wow, That Works!

Thanks a lot @nicraboy and @mhartington !

1 Like

Hello Dear i have the same issue ?

But i got different error

When i try these steps i got that type of error please check.

image