Reputation: 4182
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
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')"
Upvotes: 1