【问题标题】:node example.js and three dots, what's next?节点 example.js 和三个点,接下来是什么?
【发布时间】:2013-12-24 07:15:13
【问题描述】:

参考homepagedocumentation,我安装了node.js,创建了example.js 并运行了脚本。但我得到了 3 个点 (...),没有别的。我应该去哪里看?

> node example.js
...

在 Windows 7 x64 上运行

【问题讨论】:

  • 你的意思是“Hello World”的示例节点http服务器吗? > node example.js Server running at http://127.0.0.1:8124/?这是吗?
  • @atupal 我刚刚更新了我的问题。谢谢。是的,我期待 console.log 消息,但它没有出现。我应该把 example.js 文件放在哪里?即使在指定完整路径 D:/path/to/example.js 之后它也不起作用。
  • 也许this question 有帮助。 :)
  • 你可以在节点 REPL 中输入“.load example.js” :)

标签: node.js


【解决方案1】:

您似乎运行了node.exe,它打开了一个终端,并在该终端中输入了node example.js

所以基本上,您在交互式终端中打开了node,然后输入了node example.js,所以它试图像运行 JavaScript 一样运行它。它显示了三个点,因为那不是有效的 JavaScript 代码,它正在等待您输入更多可能使其有效的代码。

您应该在cmd 提示符下运行node.exe example.js,您会看到更像C:\> 的提示符。

【讨论】:

    猜你喜欢
    • 2014-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-28
    • 1970-01-01
    • 2017-02-05
    • 2016-12-19
    • 1970-01-01
    相关资源
    最近更新 更多