node.js - 使用 node.js v0.6.18 安装 socket.io。 ws 在安装过程中失败

标签 node.js websocket socket.io

我正在尝试在 beaglebone (linux angstrom) 上使用 npm 安装 socket.io

/> npm 安装socket.io

它在具有旧内核的旧版本 Node 上运行良好。我现在使用的是node v0.6.18。

npm 尝试安装 ws 时似乎出现问题,而 ws 应该与 socket.io 一起安装

如果我尝试,我会得到同样的错误:

npm install ws --ws:verbose

结果如下:

root@beaglebone:~# npm install ws --ws:verbose
npm http GET https://registry.npmjs.org/ws
npm http 304 https://registry.npmjs.org/ws
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/tinycolor
npm http GET https://registry.npmjs.org/options
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/tinycolor
npm http 304 https://registry.npmjs.org/options

> ws@0.4.18 install /home/root/node_modules/ws
> node install.js

[ws v0.4.18] Attempting to compile blazing fast native extensions.
info it worked if it ends with ok 
spawn python [ '/home/root/.node-gyp/0.6.18/tools/gyp_addon',
  'binding.gyp',
  '-I/home/root/node_modules/ws/build/config.gypi',
  '-f',
  'make' ]
Traceback (most recent call last):
  File "/home/root/.node-gyp/0.6.18/tools/gyp_addon", line 14, in <module>
    import gyp
  File "/home/root/.node-gyp/0.6.18/tools/gyp/pylib/gyp/__init__.py", line 8, in <module>
    import gyp.input
  File "/home/root/.node-gyp/0.6.18/tools/gyp/pylib/gyp/input.py", line 5, in <module>
    from compiler.ast import Const
ImportError: No module named compiler.ast
ERR! Error: `gyp_addon` failed with exit code: 1
    at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:226:16)
    at ChildProcess.emit (events.js:70:17)
    at maybeExit (child_process.js:362:16)
    at Process.onexit (child_process.js:398:5)
ERR! not ok
[ws v0.4.18] Native extension compilation failed.
[ws v0.4.18] On Windows, native extensions require Visual Studio and Python.
[ws v0.4.18] On Unix, native extensions require Python, make and a C++ compiler.
[ws v0.4.18] Start npm with --ws:verbose to show compilation output (if any).
ws@0.4.18 ./node_modules/ws
├── tinycolor@0.0.1
├── options@0.0.3
└── commander@0.5.2
root@beaglebone:~#

我使用的是内核 3.2.18

root@beaglebone:~# uname -a
Linux beaglebone 3.2.18 #1 Thu Jun 14 23:26:20 CEST 2012 armv7l GNU/Linux
root@beaglebone:~# 

有什么想法吗?

最佳答案

我不知道,但我做了一次完整的升级,看看是否能找到任何东西,但我没有(一切正常)。我必须重新发出命令两次(npm up -g)才能完成,我将其归因于上游服务器或网络问题。无论如何,这是我已经得到的工作正常的(基本的 Ubuntu 12.04 x64 系统):

Linux marius-i7 3.2.0-25-generic #40-Ubuntu SMP Wed May 23 20:30:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
node -v: v0.6.19
ws@0.4.18
python --version: 2.7.3

npm install -g ws --ws:verbose 输出:

/usr/local/bin/wscat -> /usr/local/lib/node_modules/ws/bin/wscat

> ws@0.4.18 install /usr/local/lib/node_modules/ws
> node install.js

[ws v0.4.18] Attempting to compile blazing fast native extensions.
make: Entering directory `/usr/local/lib/node_modules/ws/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node: Finished
  COPY Release/bufferutil.node
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/obj.target/validation.node
  SOLINK_MODULE(target) Release/obj.target/validation.node: Finished
  COPY Release/validation.node
make: Leaving directory `/usr/local/lib/node_modules/ws/build'
[ws v0.4.18] Native extension compilation successful!
tinycolor@0.0.1 /usr/local/lib/node_modules/ws/node_modules/tinycolor

options@0.0.3 /usr/local/lib/node_modules/ws/node_modules/options

commander@0.5.2 /usr/local/lib/node_modules/ws/node_modules/commander

ws@0.4.18 /usr/local/lib/node_modules/ws

我发现你使用的是 ARM 系统。抱歉我帮不了你。

关于node.js - 使用 node.js v0.6.18 安装 socket.io。 ws 在安装过程中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11089082/

相关文章:

javascript - Node 的通用日志记录,快速应用程序——最佳实践?

node.js - 在 Node.js 中创建参数化 "components"的最佳方法是什么?

node.js - Node.js 应用程序中的类型错误

python - 如何使用aiohttp获取客户端的IP地址

objective-c - 该应用程序在 Payload/<Appname>.app/<App name> : decoder 中引用了非公共(public)选择器

node.js - 为了将域切换到HTTPS,我是否需要更改Apache或Node.js应用程序?

html - 同一客户端上的多个 websocket 连接 - 服务器无法处理

websocket - 使用无服务器的自定义 api 网关 websocket 端点

javascript - 如何将 Javascript 客户端连接到 Python-SocketIO 服务器?

javascript - Socket.io客户端没有收到来自服务器的消息