简体   繁体   English

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

[英]How to install socket.io on windows 7 x64 (node.js)

Running on a Windows 7 Home Premium 64-bits 在Windows 7家庭高级版64位上运行

Downloaded: 下载:

And then followed the steps at http://blog.nowjs.com/running-nowjs-natively-on-windows , which implied on: 然后按照http://blog.nowjs.com/running-nowjs-natively-on-windows上的步骤进行操作,其中暗示:

  • installing the Microsoft Visual C++ Runtime (I got the x64 version) 安装Microsoft Visual C ++运行时(我得到了x64版本)
  • grabbing a 'fixed-for-windows' version of now.js from github.com/Flotype/now/zipball/windows 从github.com/Flotype/now/zipball/windows抓取now.js的'fixed-for-windows'版本

With everything set in place, running any example that requires the 'now' module results in a request for socket.io module. 一切就绪后,运行任何需要'now'模块的示例都会产生对socket.io模块的请求。

Running 'npm install socket.io -g' outputs: 运行'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)

Am I missing something? 我错过了什么吗? Also tried with versions 0.8.6-x64 and 0.8.5-x64 of node.js, both also packaged as msi. 还尝试使用版本0.8.6-x64和0.8.5-x64的node.js,两者也打包为msi。

Additionally, placing the fixed-for-windows version of now.js directly in a node_modules folder insite the helloworld_server.js example and running 'node helloworld_server.js' produces: 另外,将fixed.js的fixed-for-windows版本直接放在node_modules文件夹中,以helloworld_server.js为例,运行'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)

Anyone who find this on google: I'm running Windows 8 x64 and had tons of issues trying to install socket.io and other extensions into node.js due to compiler issues. 任何在谷歌上发现这个问题的人:我正在运行Windows 8 x64,由于编译器问题,尝试将socket.io和其他扩展安装到node.js有很多问题。

I tried downloading/installing GNU Make, Visual Studio Express, Visual Studio Ultimate (trial): basically everything that's recommended. 我尝试下载/安装GNU Make,Visual Studio Express,Visual Studio Ultimate(试用版):基本上是推荐的一切。 Still no dice. 仍然没有骰子。 Socket.io WOULDN'T WORK. Socket.io不会工作。

The easiest solution for me has been to just run linux inside a virtual machine and use node from that. 对我来说最简单的解决方案就是在虚拟机中运行linux并使用该节点。 - Download the x86 version of Lubuntu Linux(Very windows like): http://lubuntu.net/ - Install Linux in VirtualBox: https://www.virtualbox.org/ - Use "Bridged Adapter" inside network settings of VirtualBox for Lubuntu. - 下载x86版本的Lubuntu Linux(非常类似windows): http//lubuntu.net/ - 在VirtualBox中安装Linux: https//www.virtualbox.org/ - 在VirtualBox的网络设置中使用“桥接适配器” Lubuntu。 This will allow you to access the node server from your windows machine. 这将允许您从Windows计算机访问节点服务器。 - Install node and whatever else you want onto Lubuntu. - 在Lubuntu上安装节点和其他任何你想要的东西。 Node was initially designed for linux, so everything works flawlessly. Node最初是为linux设计的,所以一切都运行得很完美。 - The final installation with a few extras only takes 4GB on my hard drive. - 带有一些额外功能的最终安装只需要4GB的硬盘。 Not bad at all! 一点也不差!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM