繁体   English   中英

Console.log 未定义

[英]Console.log is undefined

我目前正在通过“Learnyounode”学习 Node。 但是,在我的计算机上测试一些 javascript 文件时,任何时候我都会尝试运行一个简单的“Hello World”

console.log("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.

祝你好运!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM