microsoft / cordova-plugin-code-push

Cordova plugin for CodePush
http://appcenter.ms
Other
643 stars 330 forks source link

Cannot read property "toLowerCase" of undefined on release-cordova #321

Closed superpikar closed 6 years ago

superpikar commented 6 years ago

Hello, I'm not sure whether this error is from code-push-cli or cordova-plugin-code-push, since I couldn't find anything related to "toLowerCase" in cordova-plugin-code-push repo.

Following is the description of the problem

Description

I have an existing app built using onsenui+vuejs+cordova, and has no error before.

Then I follows all the step from tutorial https://microsoft.github.io/code-push/docs/cordova.html#link-4, but when I tried to release an update, I got the following error :

Error: Cannot read property 'toLowerCase' of undefined
[Error]  Unable to prepare project. Please ensure that the CWD represents a Cordova project and that the "android" platform was added by running "cordova platform add android".

The complete output of the release-cordova command above are

$ code-push release-cordova onsenui-vue-cordova-test android
Running "cordova prepare" command:

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 android
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 android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at C:\nodejs\onsenui-vue-cordova-test\platforms\android\res\xml\config.xml
Merging project's config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms\android\platform_www] to platforms\android\assets\www
  copy  www\index.html platforms\android\assets\www\index.html (updated file)
  copy  www\static\css\app.ced914462c68e17391bb626ff202bb88.css platforms\android\assets\www\static\css\app.ced914462c68e17391bb626ff202bb88.css (updated file)
  copy  www\static\fonts\Material-Design-Iconic-Font.a4d3112.woff2 platforms\android\assets\www\static\fonts\Material-Design-Iconic-Font.a4d3112.woff2 (updated file)
  copy  www\static\fonts\Material-Design-Iconic-Font.b351bd6.ttf platforms\android\assets\www\static\fonts\Material-Design-Iconic-Font.b351bd6.ttf (updated file)
  copy  www\static\fonts\Material-Design-Iconic-Font.d2a55d3.woff platforms\android\assets\www\static\fonts\Material-Design-Iconic-Font.d2a55d3.woff (updated file)
  copy  www\static\fonts\fontawesome-webfont.674f50d.eot platforms\android\assets\www\static\fonts\fontawesome-webfont.674f50d.eot (updated file)
  copy  www\static\fonts\fontawesome-webfont.af7ae50.woff2 platforms\android\assets\www\static\fonts\fontawesome-webfont.af7ae50.woff2 (updated file)
  copy  www\static\fonts\fontawesome-webfont.b06871f.ttf platforms\android\assets\www\static\fonts\fontawesome-webfont.b06871f.ttf (updated file)
  copy  www\static\fonts\fontawesome-webfont.fee66e7.woff platforms\android\assets\www\static\fonts\fontawesome-webfont.fee66e7.woff (updated file)
  copy  www\static\fonts\ionicons.19e65b8.eot platforms\android\assets\www\static\fonts\ionicons.19e65b8.eot (updated file)
  copy  www\static\fonts\ionicons.2c159d0.woff platforms\android\assets\www\static\fonts\ionicons.2c159d0.woff (updated file)
  copy  www\static\fonts\ionicons.dd4781d.ttf platforms\android\assets\www\static\fonts\ionicons.dd4781d.ttf (updated file)
  copy  www\static\images\bg-bluetooth.jpg platforms\android\assets\www\static\images\bg-bluetooth.jpg (updated file)
  copy  www\static\images\bg-camera.jpg platforms\android\assets\www\static\images\bg-camera.jpg (updated file)
  copy  www\static\images\bg-contact.jpg platforms\android\assets\www\static\images\bg-contact.jpg (updated file)
  copy  www\static\images\bg-socmed.jpg platforms\android\assets\www\static\images\bg-socmed.jpg (updated file)
  copy  www\static\images\output\bg-bluetooth-small.jpg platforms\android\assets\www\static\images\output\bg-bluetooth-small.jpg (updated file)
  copy  www\static\images\output\bg-camera-small.jpg platforms\android\assets\www\static\images\output\bg-camera-small.jpg (updated file)
  copy  www\static\images\output\bg-contact-small.jpg platforms\android\assets\www\static\images\output\bg-contact-small.jpg (updated file)
  copy  www\static\images\output\bg-socmed-small.jpg platforms\android\assets\www\static\images\output\bg-socmed-small.jpg (updated file)
  copy  www\static\images\photothumb.db platforms\android\assets\www\static\images\photothumb.db (updated file)
  copy  www\static\img\fontawesome-webfont.912ec66.svg platforms\android\assets\www\static\img\fontawesome-webfont.912ec66.svg (updated file)
  copy  www\static\img\ionicons.aff28a2.svg platforms\android\assets\www\static\img\ionicons.aff28a2.svg (updated file)
  copy  www\static\img\onsenui-logo.e2e87d4.png platforms\android\assets\www\static\img\onsenui-logo.e2e87d4.png (updated file)
  copy  www\static\js\app.2a3e5c019e9525355482.js platforms\android\assets\www\static\js\app.2a3e5c019e9525355482.js (updated file)
  copy  www\static\js\app.2a3e5c019e9525355482.js.map platforms\android\assets\www\static\js\app.2a3e5c019e9525355482.js.map (updated file)
  copy  www\static\js\manifest.afdcf9b6018d3929c3e9.js platforms\android\assets\www\static\js\manifest.afdcf9b6018d3929c3e9.js (updated file)
  copy  www\static\js\manifest.afdcf9b6018d3929c3e9.js.map platforms\android\assets\www\static\js\manifest.afdcf9b6018d3929c3e9.js.map (updated file)
  copy  www\static\js\vendor.7e924fb545c810c1f89a.js platforms\android\assets\www\static\js\vendor.7e924fb545c810c1f89a.js (updated file)
  copy  www\static\js\vendor.7e924fb545c810c1f89a.js.map platforms\android\assets\www\static\js\vendor.7e924fb545c810c1f89a.js.map (updated file)
Wrote out android application name "onsenui-vue-cordova-test" to C:\nodejs\onsenui-vue-cordova-test\platforms\android\res\values\strings.xml
Error: Cannot read property 'toLowerCase' of undefined
[Error]  Unable to prepare project. Please ensure that the CWD represents a Cordova project and that the "android" platform was added by running "cordova platform add android".

Reproduction

Clone my project here https://github.com/superpikar/onsenui-vue-cordova-test , then :

# install dependency
npm install

# install cordova plugin
cordova prepare

# build app to /www
npm run build

# release update to codepush, use your own app name
code-push release-cordova onsenui-vue-cordova-test android

Additional Information

This is the installed dependency on my project :

## environment 
node: 6.11.2
cordova: 7.0.1
code-push-cli: 2.1.2-beta

## cordova platform list
android: 6.2.3
browser 4.1.0

## cordova plugins
cordova-plugin-code-push: ^1.10.0-beta

(The more info the faster we will be able to address it!)

superpikar commented 6 years ago

I tried to remove all cordova-plugins then running the following command

cordova prepare

I still get the same error

Error: Cannot read property 'toLowerCase' of undefined

Seems like this problem is not related with cordova-plugin-code-push.

Any people here face the same issue?

superpikar commented 6 years ago

Nevermind, I was able to solve the problem by starts the project from scratch.