http - node.js 安装错误需要 (‘http’ );

标签 http node.js ubuntu ubuntu-11.10

我正在按照这些说明在 Ubuntu 上安装 node.js (
http://nodenode.com/post/1197688151/installing-node-js-on-ubuntu-screencast-tutorial )

我在最后一步收到以下错误

我输入 node hello_node.js
我的终端回复

/home/joe/tmp/hello_node/hello_node.js:1
require(‘http’);
    ^

 node.js:201
    throw e; // process.nextTick error, or 'error' event on first tick
          ^
 SyntaxError: Unexpected token ILLEGAL
     at Module._compile (module.js:427:25)
      at Object..js (module.js:450:10)
  at Module.load (module.js:351:31)
  at Function._load (module.js:310:12)
  at Array.0 (module.js:470:10)
  at EventEmitter._tickCallback (node.js:192:40)

所以,看来我“需要”http。我做错了什么......或者更糟,愚蠢?

最佳答案

您没有使用普通的单引号。你有:

require(‘http’);

它应该是:
require('http');

关于http - node.js 安装错误需要 (‘http’ );,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10626370/

相关文章:

java - 在 ubuntu 中安装 eclipse(eclipse-jee-helios-linux-gtk-x86_64) 时出错

Python 请求 post 不发送字符串

java - 本地路径的 OSGi httpService.registerResources()

python - 尝试获取 HTTP 代码。有人可以在他们的 Python 解释器中为我尝试这段代码,看看为什么它不起作用吗?

ajax - 浏览器如何使用 WebSocket 处理 DNS 查找和 TLS?

json - 多语言 Jade 模板?

node.js - React Native package.json 版本

javascript - 将标记渲染到 Jade

c - readline.h 不在 32 位 ubuntu 中,而是在 64 位中?

ubuntu - 无法在 Docker 容器中安装 ntopng(rfkill 问题)