ionic-cli: TypeError: Cannot read property 'find' of null
whenever i run build android command . my project is giving me this error.It was working fine earlier
[WARN] Error occurred during command execution from a CLI plugin (@ionic/cli-plugin-cordova). TypeError: Cannot read property ‘find’ of null;
Description:
Steps to Reproduce:
Example repo:
Output:
My ionic info
:
@ionic/cli-plugin-cordova : 1.6.2
@ionic/cli-plugin-ionic-angular : 1.4.1
@ionic/cli-utils : 1.7.0
ionic (Ionic CLI) : 3.7.0
global packages:
Cordova CLI : 6.5.0
local packages:
@ionic/app-scripts : 2.1.3
Cordova Platforms : none
Ionic Framework : ionic-angular 3.6.0
System:
Android SDK Tools : 25.2.5
Node : v7.10.0
OS : Windows 10
npm : 5.3.0
Other Information:
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 29 (9 by maintainers)
Commits related to this issue
- fix(cordova): more robust error handling for serve, shutdown functions fixes https://github.com/ionic-team/ionic-cli/issues/2623 — committed to ionic-team/ionic-cli by imhoffd 7 years ago
hi got the issue. i checked the git and found that all detail from my config file was missing. i don’t know how it got deleted but now it is working
This might be old, but I ran into the issue and found out what was wrong with my
config.xml
in case anyone runs into the same issue. In my case I defined an iOS only setting outside the ios platform block. It was working whilst i was doing iOS build but when i went to build android I got the error.So as a quick debug delete any additional options one by one to find the culprit. From there you can figure out why its broken. In my case it was defining
edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription"
outside theplatform name="ios"
tag.Hope this helps someone! (P.S. im more or less on bleeding edge cordova and it is still an issue)
When I run the command
ionic cordova run android --livereload --address [MY EXTERNAL IP]
myconfig.xml
file goes blank. Once theconfig.xml
file is blank, trying to run your app will produce the errorTypeError: Cannot read property 'find' of null
config.xml. i don’t know how i got it empty. may be while changing app version manually, something goes wrong my side.
I had the same problem, fortunately, I found a config.xml in one of my last builds (android).
Check the following directories, if there is maybe a
config.xml
inside:path/to/your/project/platforms/android/res/xml/config.xml
<–path/to/your/project/platforms/android/build/intermediates/res/merged/debug/xml/config.xml
<–As I run allways the
ionic cordova run android --device --livereload
command assudo
, likesudo ionic cordova run android --device --livereload
, theconfig.xml
’s were read-only.In case You have a iOS build, try to change the
android
part of the paths to iOS.Hope the best for You guys. Never forget to backup your data.
That is crazy, I just had the same problem. I’m sure that my config.xml file was correct yesterday. Its is empty now!
edit: for what I remember, that could be a update of cordova I made yesterday. Still don’t explain the empty file
https://github.com/ionic-team/ionic-app-scripts/releases/tag/v3.0.0 ionic build android --aot --minifyjs --minifycss it created my config.xml blanked
How can i fix this?
TypeError: Cannot read property ‘find’ of null at ConfigXml.resetContentSrc (C:\Users.…\AppData\Roaming\npm\node_modules\ionic\node_modules@ionic\cli-utils\lib\cordova\config.js:63:34) at RunCommand.<anonymous> (C:\Users.…\AppData\Roaming\npm\node_modules\ionic\dist\commands\cordova\base.js:151:18) at next (native) at fulfilled (C:\Users.…\AppData\Roaming\npm\node_modules\ionic\node_modules\tslib\tslib.js:93:62)
Thanks @proclnas !! I found the bug… I just wasn’t handling errors properly. Node is a little rough sometimes.
@vksgautam1 I had exactly the same issue. Config.xml got empty! Thanks for sharing. @buddywa I also did the same thing. I run --livereload. Then this error started happening…