GTS Joe
GTS Joe

Reputation: 4182

Running Node.js Commands in the Windows Command Prompt

In Linux, if I run the following command in the CLI:

node -e 'console.log( "Hello, world!" );'

I get the expected output:

Hello, world!

However, in Windows, if I run

node -e 'console.log( "Hello, world!" );'

Even though I have Node.js v12.8.0 installed, I get:

SyntaxError: Invalid or unexpected token

How can I run Node.js commands like console.log() from the Windows command prompt?

Upvotes: 0

Views: 1212

Answers (1)

Shivam
Shivam

Reputation: 3642

I'm not sure but seems like a it's just Quotation mark error because this worked for me

node -e  "console.log('Hello World')"

Image

Upvotes: 1

Related Questions