Nativescript-cli: Migrating to NativeScript 6.0 - Cannot read property 'toLowerCase' of undefined

Created on 8 Oct 2019  路  6Comments  路  Source: NativeScript/nativescript-cli

After I migrate my project to cli 6 tns migrate update cocoapods/brew/node/everything..

tns run ios

Webpack build done!
Project successfully prepared (ios)
Cannot read property 'toLowerCase' of undefined

The app was compiling and running fine before I upgraded to v6?

needs more info

Most helpful comment

I resolved it looking for in ./hooks folder. I found hookArgs.platform.toLowerCase() and I had to change to (hookArgs.platform || '').toLowerCase();

All 6 comments

@sputn1k,

Try the following:

rm -rf node_modules hooks platforms && tns run ios

@Fatme , Still says the same thing - Cannot read property 'toLowerCase' of undefined

Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `ProjectName.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There are 8 dependencies from the Podfile and 11 total pods installed.
Project successfully prepared (ios)
Cannot read property 'toLowerCase' of undefined

@sputn1k,

Can you execute the command with --log trace (tns run ios --log trace) and send us the produced log ?

Android also having the same issue. i ran with tns run android --log trace

Cannot read property 'toLowerCase' of undefined
Error: Cannot read property 'toLowerCase' of undefined
at Errors.failWithOptions (C:\Users\\AppData\Roamingnpmnode_modulesnativescript\lib\common\errors.js:147:28)
at Errors.fail (C:\Users\\AppData\Roamingnpmnode_modulesnativescript\lib\common\errors.js:120:21)
at DevicesService. (C:\Users\\AppData\Roamingnpmnode_modulesnativescript\lib\common\mobile\mobile-coredevices-service.js:376:30)
at Generator.throw ()
at rejected (C:\Users\\AppData\Roamingnpmnode_modulesnativescript\lib\common\mobile\mobile-coredevices-service.js:11:65)
at processTicksAndRejections (internal/process/task_queues.js:86:5)

I resolved it looking for in ./hooks folder. I found hookArgs.platform.toLowerCase() and I had to change to (hookArgs.platform || '').toLowerCase();

This issue is probably caused by plugin hooks which are not compatible with NativeScript 6.0.0. @Oscarato fix is what should be applied in the plugin itself.
As there's nothing to do in the CLI, I'm closing this issue.

Was this page helpful?
0 / 5 - 0 ratings