Issue
I create a new nativescript application (ns create xxxx) and then run it to get it loaded into a simulator (ns run ios).
Once running, I add a console log anywhere (on init, or as an action from a button click etc.) and it will not output to the console.
I have found a thread on Stack that posed a similar question but it looks like they never got much feedback (and others reported the issue).
I have tried running in the VSCode terminal as well as the regular terminal (so it’s not a VSCode thing). I am completely floored on what could be causing this.
Solution
This looks strange because console.log
s usually work ok. Please check the following
-
Be sure that you do not run your application in release mode or with
--env.uglify
flag because it may cause drop logging -
Disable hot module replacement option. Sometimes it cause issues.
-
Be sure to use correct
console
operations. For exampleconsole.debug
is not supported. You can find full list here -
Remove
node_modules
,platforms
andhooks
folders before next run. Just in case. -
Don’t you have
console
object overridden by some other object? -
Try to change your
console.log
command withalert
and check if it works.
Please, come back after your check all the points from this checklist, also please add the report from your ns doctor
command, and let’s see if we can move on
Update:
Since you’re using MacBook based on M1 processor it seems that your question is related to this issue:
https://github.com/NativeScript/nativescript-cli/issues/5454
Unfortunately, the only advice I can give you for now is to follow the thread for some solution or workarounds