Javascript Console.log未定义

Javascript Console.log未定义,javascript,Javascript,我目前正在通过“Learnyounode”学习节点。 然而,当在我的计算机上测试一些javascript文件时,每当我试图运行一个简单的“Hello World”时 它给了我一个返回的错误 Error: 'console' is undefined. 这是我的命令提示符有问题还是我的系统有错误?我需要重新安装Javascript吗?我的代码在浏览器控制台中运行良好,但在本地命令行中运行不正常 任何帮助都将不胜感激,提前感谢 我知道从NodeJS开始很难。。。尝试以下方法: 1. Create

我目前正在通过“Learnyounode”学习节点。 然而,当在我的计算机上测试一些javascript文件时,每当我试图运行一个简单的“Hello World”时

它给了我一个返回的错误

Error: 'console' is undefined.
这是我的命令提示符有问题还是我的系统有错误?我需要重新安装Javascript吗?我的代码在浏览器控制台中运行良好,但在本地命令行中运行不正常


任何帮助都将不胜感激,提前感谢

我知道从NodeJS开始很难。。。尝试以下方法:

1. Create a .js file... call it test.js
2. In the file write command:

    console.log('hello world from node');

3. save the file.
4. Navigate to that directory and type:

    node test.js

Now you will see the output.

祝你好运

看看下面的帖子,这可能会解释你看到的结果:这是你的问题:记住,如果答案解决了你的问题,就把它标记为接受:)谢谢!那是因为我没有用node引导它。输出成功了,现在我开始学习!
1. Create a .js file... call it test.js
2. In the file write command:

    console.log('hello world from node');

3. save the file.
4. Navigate to that directory and type:

    node test.js

Now you will see the output.