question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

šŸ› `console.log` not working in player.js

See original GitHub issue

Environment

  System:
    OS: Windows 10
    CPU: x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 8.48 GB / 15.86 GB
  Binaries:
    Yarn: 1.5.1 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 5.7.1 - C:\Program Files\nodejs\npm.CMD
  Virtualization:
    Docker: 18.03.0 - C:\Program Files\Docker\Docker\Resources\bin\docker.EXE
  IDEs:
    VSCode: 1.23.1 - C:\Program Files\Microsoft VS Code\bin\code.CMD
  Languages:
    Bash: 4.4.12 - C:\Program Files\Git\usr\bin\bash.EXE
    Python: 2.7.14 - /c/Python27/python
  Browsers:
    Edge: 42.17666.1000.0
    Internet Explorer: 11.0.17666.1000

Steps to reproduce

  1. Install warriorjs
  • npm i -g warriorjs
  1. Bootstrap with warriorjs
  • warriorjs (follow default config)
  1. Open Player.js and add a console.log('hello') statement in the playTurn method
  • playTurn () { console.log('Hello World'); }
  1. Run warriorjs
  • warriorjs (select your character to run)
  1. The log is not displayed

Expected Behavior

All console statements should be displayed in the output (or at least logged to a file).

Actual Behavior

No console statements display.

Additional Notes

So far I think the issue comes from running in a new vm context. That call happens here: https://github.com/olistic/warriorjs/blob/master/packages/warriorjs-core/src/PlayerLoader.js#L23

And finally, this is a really cool project. Thanks to everyone for the great work so far!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
olisticcommented, May 16, 2018

WarriorJS v0.3.0 includes a think ability that can be used as an alternative for console.log. Itā€™s not perfect yet, but I think itā€™s good enough for now. Let me know if you have any feedback, Iā€™m closing this ticket now.

6reactions
pajtaicommented, May 13, 2018

I found using the debugger super helpful.

Itā€™s easiest with a local npm install:

npm i @warriorjs/cli

and then add an index.js as follows

'use strict';

require('@warriorjs/cli/bin/warriorjs');

now you can debug with:

node --inspect-brk index.js - just drop a debugger in player.js and play around with the commands.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Console.log not working at all - Stack Overflow
To solve it I opened the Developer Console (in Chrome), right clicked on the reload arrow next to the URL bar and selected...
Read more >
What went wrong? Troubleshooting JavaScript - MDN Web Docs
Go to the tab that you've got number-game-errors.html open in, and open your JavaScript console. You should see an error message along theĀ ......
Read more >
View log messages in Console on Mac - Apple Support
Use Console on your Mac to view the log messages collected by your computer and connected devices.
Read more >
The ultimate guide to JavaScript console log - VitaminDev
Just like logging an error, to log an exception use the console.error function. try { throw newĀ ...
Read more >
Concepts: JavaScript Debugging Basics - Brightcove
The console object has several methods, including: The log() method for general output of logging information. This allows string substitutionĀ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found