gpt4 book ai didi

windows - 如何在 Windows 7 x64 (node.js) 上安装 socket.io

转载 作者:可可西里 更新时间:2023-11-01 09:38:29 24 4
gpt4 key购买 nike

在 Windows 7 家庭高级版 64 位上运行

已下载:

然后按照 http://blog.nowjs.com/running-nowjs-natively-on-windows 中的步骤操作, 这意味着:

  • 安装 Microsoft Visual C++ Runtime(我得到的是 x64 版本)
  • 从 github.com/Flotype/now/zipball/windows 获取 now.js 的“fixed-for-windows”版本

一切就绪后,运行任何需要“现在”模块的示例都会导致对 socket.io 模块的请求。

运行“npm install socket.io -g”输出:

C:\Windows\System32>npm install socket.io -g
npm http GET https://registry.npmjs.org/socket.io
npm http 304 https://registry.npmjs.org/socket.io
npm http GET https://registry.npmjs.org/policyfile/0.0.4
npm http GET https://registry.npmjs.org/socket.io-client/0.9.10
npm http GET https://registry.npmjs.org/redis/0.7.2
npm http 304 https://registry.npmjs.org/policyfile/0.0.4
npm http 304 https://registry.npmjs.org/socket.io-client/0.9.10
npm http 304 https://registry.npmjs.org/redis/0.7.2
npm http GET https://registry.npmjs.org/hiredis
npm http GET https://registry.npmjs.org/uglify-js/1.2.5
npm http GET https://registry.npmjs.org/xmlhttprequest/1.4.2
npm http GET https://registry.npmjs.org/ws
npm http GET https://registry.npmjs.org/active-x-obfuscator/0.0.1
npm http 304 https://registry.npmjs.org/hiredis
npm WARN package.json hiredis@0.1.14 No README.md file found!

> hiredis@0.1.14 preinstall C:\Program Files\nodejs\node_modules\socket.io\node_
modules\redis\node_modules\hiredis
> make || gmake

cd deps/hiredis && make static
process_begin: CreateProcess(NULL, sh -c "type cc >/dev/null 2>/dev/null && echo
cc || echo gcc", ...) failed.
process_begin: CreateProcess(NULL, sh -c "uname -s 2>/dev/null || echo not", ...
) failed.
make[1]: Entering directory `C:/Program Files/nodejs/node_modules/socket.io/node
_modules/redis/node_modules/hiredis/deps/hiredis'
std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g
-ggdb net.c
'std' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
make[1]: [net.o] Error 1 (ignored)
std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g
-ggdb hiredis.c
'std' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
make[1]: [hiredis.o] Error 1 (ignored)
std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g
-ggdb sds.c
'std' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
make[1]: [sds.o] Error 1 (ignored)
std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g
-ggdb async.c
'std' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
make[1]: [async.o] Error 1 (ignored)
ar rcs libhiredis.a net.o hiredis.o sds.o async.o
process_begin: CreateProcess(NULL, ar rcs libhiredis.a net.o hiredis.o sds.o asy
nc.o, ...) failed.
make (e=2): O sistema não pode encontrar o arquivo especificado.
make[1]: *** [libhiredis.a] Error 2
make[1]: Leaving directory `C:/Program Files/nodejs/node_modules/socket.io/node_
modules/redis/node_modules/hiredis/deps/hiredis'
make: *** [all] Error 2
'gmake' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
npm WARN optional dep failed, continuing hiredis@0.1.14
npm http 304 https://registry.npmjs.org/uglify-js/1.2.5
npm http 304 https://registry.npmjs.org/xmlhttprequest/1.4.2
npm http 304 https://registry.npmjs.org/active-x-obfuscator/0.0.1
npm http 304 https://registry.npmjs.org/ws
npm http GET https://registry.npmjs.org/zeparser/0.0.5
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/zeparser/0.0.5
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.21 install C:\Program Files\nodejs\node_modules\socket.io\node_modules\
socket.io-client\node_modules\ws
> node install.js

[ws v0.4.21] Attempting to compile blazing fast native extensions.
[ws v0.4.21] Native code compile failed (but the module will still work):
[ws v0.4.21] The native extensions are faster, but not required.
[ws v0.4.21] On Windows, native extensions require Visual Studio and Python.
[ws v0.4.21] On Unix, native extensions require Python, make and a C++ compiler.

[ws v0.4.21] Start npm with --ws:verbose to show compilation output (if any).
socket.io@0.9.10 C:\Program Files\nodejs\node_modules\socket.io
+-- policyfile@0.0.4
+-- redis@0.7.2
+-- socket.io-client@0.9.10 (xmlhttprequest@1.4.2, uglify-js@1.2.5, active-x-obf
uscator@0.0.1, ws@0.4.21)

我错过了什么吗?还尝试了 node.js 的 0.8.6-x64 和 0.8.5-x64 版本,它们也都打包为 msi。

此外,将 now.js 的固定 Windows 版本直接放在 helloworld_server.js 示例中的 node_modules 文件夹中并运行“node helloworld_server.js”会产生:

[Error: no errorc:\xampp\htdocs\node-tcg\node_modules\now\bin\proxy.node]
Error: no errorc:\xampp\htdocs\node-tcg\node_modules\now\bin\proxy.node
at Object.Module._extensions..node (module.js:485:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (c:\xampp\htdocs\node-tcg\node_modules\now\lib\proxy.j
s:10:13)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)

最佳答案

任何在谷歌上找到这个的人:我运行的是 Windows 8 x64,由于编译器问题,我在尝试将 socket.io 和其他扩展安装到 node.js 时遇到了很多问题。

我尝试下载/安装 GNU Make、Visual Studio Express、Visual Studio Ultimate(试用版):基本上所有推荐的东西。仍然没有骰子。 Socket.io 将无法工作。

对我来说最简单的解决方案是在虚拟机中运行 Linux 并从中使用 Node 。- 下载 x86 版本的 Lubuntu Linux(非常像 windows):http://lubuntu.net/- 在 VirtualBox 中安装 Linux:https://www.virtualbox.org/- 在 Lubuntu 的 VirtualBox 网络设置中使用“桥接适配器”。这将允许您从 Windows 计算机访问 Node 服务器。- 在 Lubuntu 上安装 Node 和任何你想要的东西。 Node 最初是为 linux 设计的,所以一切都可以完美运行。- 带有一些附加功能的最终安装只占用我硬盘上的 4GB 空间。一点都不差!

关于windows - 如何在 Windows 7 x64 (node.js) 上安装 socket.io,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11981057/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com