[Solved] Cordova: Cannot read property 'replace' of undefined
-
Hey guys I get this error on doing
cordova run ios -d
.** BUILD SUCCEEDED **
No scripts found for hook “before_deploy”.
Error: Cannot read property ‘replace’ of undefinedI already checked
cordova requirements
it’s all in place.
Any ideas?
Alsocordova build ios
worked with no problems. -
Hi,
You’ve specified a hook in your cordova/config.xml which does not exists. Check for hook documentation.
-
Hey @rstoenescu
Thanks for getting back to me!
I never set or changed anything to the Cordova files, so it’s a bug that exists upon install after following the docs here.I’ll look into it now and come back if I find a bug fix for this!
This is the standard cordova/config.xml that was installed to my directory:
<?xml version='1.0' encoding='utf-8'?> <widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>HelloCordova</name> <description> A sample Apache Cordova application that responds to the deviceready event. </description> <author email="dev@cordova.apache.org" href="http://cordova.io"> Apache Cordova Team </author> <content src="index.html" /> <access origin="*" /> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-intent href="tel:*" /> <allow-intent href="sms:*" /> <allow-intent href="mailto:*" /> <allow-intent href="geo:*" /> <platform name="android"> <allow-intent href="market:*" /> </platform> <platform name="ios"> <allow-intent href="itms:*" /> <allow-intent href="itms-apps:*" /> </platform> <engine name="ios" spec="^4.4.0" /> <plugin name="cordova-plugin-whitelist" spec="^1.3.2" /> </widget>
-
I wasn’t able to find anything…
When I runcordova run ios -d
it first gets built and I get a lot of those “no scripts found for …” but none of them through errors. Then after the build and before the deployment, that’s where it errors it seems…
This is what I get just after running:No scripts found for hook “before_run”.
No scripts found for hook “before_prepare”.
Checking config.xml and package.json for saved platforms that haven’t been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform ios
Checking config.xml for saved plugins that haven’t been added to the project
Checking for any plugins added to the project that have not been installed in ios platform
No differences found between plugins added to project and installed in ios platform. Continuing…
Generating platform-specific config.xml from defaults for iOS at /Users/lucaban/Sites/lucaban/resources/Listo/cordova/platforms/ios/HelloCordova/config.xml
Merging project’s config.xml into platform-specific iOS config.xml
Merging and updating files from [www, platforms/ios/platform_www] to platforms/ios/www
Current launch storyboard undefined
Not changing launch storyboard setting in info plist.
Wrote out iOS Bundle Identifier “io.cordova.hellocordova” and iOS Bundle Version “1.0.0” to /Users/lucaban/Sites/lucaban/resources/Listo/cordova/platforms/ios/HelloCordova/HelloCordova-Info.plist
No need to update build settings for launch storyboard support.
iOS Product Name has not changed (still “HelloCordova”)
This app does not have icons defined
This app does not have splash screens defined
Updating launch storyboard images at platforms/ios/HelloCordova/Images.xcassets/LaunchStoryboard.imageset/
Updating Storyboard image set contents.json
This app does not have additional resource files defined
Prepared iOS project successfully
No scripts found for hook “after_prepare”.Even with this above, the
build
succeeds. But right after it fails, probably inside thedeploy
section. -
I’m tracking it down.
Currently I know that the error occurs on this line:
return Q.resolve(iossim.getdevicetypes());
in the file:
/cordova/platforms/ios/cordova/lib/list-emulator-images
-
I was able to solve the issue after following the answer here:
https://github.com/phonegap/ios-sim/issues/210Please beware not to edit the ios-sim source files of the wrong node_modules folder!!!
The correct folder to edit the ios-sim source files is the one located at/cordova/platforms/ios/cordova/node_modules/ios-sim/src/lib.js
.