ZeroStack
ZeroStack

Reputation: 1109

Browser console.log() not showing in terminal

I have just started a new meteor application following a tutorial. Meteor is running the app on my local host and when I enter 'console.log("Hello world");' in the browser console:

console.log("Hello world");
Hello world
undefined

When I check my terminal console there is nothing showing up there:

=> Started proxy.
=> Started MongoDB.     
=> Started your app.   

=> App running at: http://localhost:3000/

I'm using Mac Os X, Google Chrome and I've ensured the following are added on meteor (if its even relevant):

meteor add autopublish
meteor add insecure

Moreover, the html and js files meteor has created in my app folder have no code in them.

Thanks.

S

Upvotes: 1

Views: 7673

Answers (1)

twhy
twhy

Reputation: 46

When you enter console.log("Hello world"); in the browser console, you're running the code in your browser only.

Try put a main.js at the root of your project folder, and write down console.log("Hello world"); in it, then you'll get log messages in both terminal console and browser console.

This is because main.js runs in both environment.

Code in /client run in browser only, and code in /server run in server only. Code that is not in /client or /server runs in both browser and server.

For more details, see http://docs.meteor.com/#structuringyourapp

Upvotes: 3

Related Questions