"Error: Cannot read property ‘replace’ of undefined" for ios-sim

so what I have to do to fix this problem? I’ve lost hours because sometimes doesn’t works!!!

Spend a few more minutes to read the posts above. There were multiple solutions proposed that worked for many people - according to the thanks they posted.

thanks, but I’ve tried ‘npm i ios-sim@latest’ it but not works. I need ‘sudo npm i ios-sim@latest’

Hi fdambrosio, the problem is that the ios-sim, when installed through ionic (which is required), isn’t the latest version, which results in this bug not already being fixed. Sujan12 Moderator on June 9th posted a great way to update your project’s ios-sim, fixing this issue. Also, I’ve found that if you specify a target (ex. $ ionic cordova emulate ios --target=“iPhone-6s”) then it bypasses the issue altogether in case you don’t want to update every one of your affected projects.

1 Like