Getting error while adding platform iOS in ionic


#1

hey,
when I am adding platform iOS for building my app I am getting Error: " Cannot read property ‘indexOf’ of null".
I am attaching screenshot also.
please help regarding this issue.


#2

@chandanionic Why running your command with sudo?


#3

Hey Devinz,
Thanks for reply I used sudo command because sudo command requires a non-blank admin password. and i am not admin so every time it will ask for password if different user will use it.

and i also tried to build without sudo command and sharing screen shot of that also, it also throwing some error.
thanks do needful.


#4

As you can see in your screen-shot, there’s no error “cannot read property indexOf null” without using sudo. You should not use sudo at any time when you are working with NPM command and ionic features, it will get you to weird behaviour and mess up all the ownership of your project folders and files.

Now you get a permission denied error, try to recreate a ionic project without sudo but just using:

chmod -R 777 ionicProjectFolder

And then try to add iOS platform in it.


#5

hey Devniz,
thanks for your reply,i tried your suggessted solution,using this i give permission to my IonicProjectFolder but the file that shows in screen shot not taking permission still, i dont know how to give permission to such perticular file.
thanks suggest me what should i do.


#6

I’m having the same problem. The problem seems to occur only with existing projects, since creating a new project doesn’t run into that error when adding iOS platform.

I had a theory, that the problem would lie in the latest release (4.0.1) of iOS platform. But I think that the problem is somewhere else, because the following did not help at all:

ionic platform remove ios && ionic platform add ios@4.0.0

Hopefully someone finds out a solution to this problem!


#7

Hey we’re seeing more reports of this, if possible could people post the output of ionic info to https://github.com/driftyco/ionic-cli/issues/815 so we can try and track it down? Thanks!