簡體   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