草庐IT

windows - Windows : cannot load module node-proxy 上的 Node.Js + Now.js

coder 2024-06-07 原文

我正在尝试使用 node.js 和 now.js 为移动设备创建聊天客户端。问题是服务器必须在 windowsserver 上运行。让 node.js 工作不是问题。

问题是now.js。我已经安装了 node.js 和模块:now.js 及其依赖项 socket.io、socket.io-client。但是 socket.io 仍然需要模块 node-proxy。这在 Windows 上不起作用,因为它必须在安装后构建。

有谁知道如何让 node.js 的模块 node-proxy 在 Windows 上运行?我读过一些关于使用 cygwin 构建的内容,但我没有关于 cygwin 的经验(或知识)。

最佳答案

我正在处理问题评论中包含的链接 nevf 的内容。我总是害怕链接会在某个时候失效。感谢来自源链接的用户 george 提供了这个让我启动并运行的解决方案。

I just wrote a tutorial about getting it running under windows 7: http://nodegames.blogspot.com/2011/12/install-nowjs-in-windows.html Summation:

Install nowjs in Windows

First you have to go through the process of installing node.js in windows. I have detailed the process here: http://nodegames.blogspot.com/2011/12/install-nodejs-in-windows.html

There's two requirements for nowjs to run on windows:

Microsoft Visual C++ Runtime:

Go ahead and install it if you don't already have it.

http://www.microsoft.com/download/en/details.aspx?id=5555

socket.io:

So we can open a CMD window and type:

C:\progra~1\nodejs\npm install socket.io

If your node.js install is in a different directory then change the path accordingly.

NPM will install it to:

C:\Program Files\nodejs\node_modules\socket.io

Good. Now we need to obtain the nowjs windows build here:

https://github.com/Flotype/now/zipball/windows

The file will read something like Flotype-now-0.7.6-3-gb41b2b2.zip

Unzip it to a folder. Inside that folder you'll have another folder with a similar name.

So: ~\Downloads\Flotype-now-0.7.6-3-gb41b2b2\Flotype-now-b41b2b2

Let's rename the second folder to now

So: ~Downloads\Flotype-now-0.7.6-3-gb41b2b2\now

Copy out the now folder and paste it to:

C:\Program Files\nodejs\node_modules\

So: C:\Program Files\nodejs\node_modules\now

Inside of that now folder there should be subfolders like bin, doc, examples and other items.

You now have nowjs installed within windows as a module for node.js. It looks like quite a bit of steps, but in reality it is quite painless and if you followed the steps you've seen that.

Time to test it!

The nowjs people have supplied us with three example projects:

They are located in: C:\Program Files\nodejs\node_modules\now\examples express_example helloworld_example multiroomchat_example

Let's jump to the fun stuff and try and get multiroomchat_example going.

Firstly close down any node.js server CMD window instances you have running.

Open up a new CMD window and type:

C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules \now\examples\multiroomchat_example\multiroomchat_server.js

Hit enter.

You now have node.js running the multiroom chat example server.

Take a look by pointing a few browsers to http://localhost:8080/ it will prompt you for a name.

And if everything went perfectly you have now installed and tested nowjs.

A multi-room chat example in under 10 minutes, less than that if you're quick! From this point we have the ability to communicate in real-time to multiple browsers and a server, the basis for a MMORPG.

关于windows - Windows : cannot load module node-proxy 上的 Node.Js + Now.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7966992/

有关windows - Windows : cannot load module node-proxy 上的 Node.Js + Now.js的更多相关文章

  1. ruby - 在 Ruby 程序执行时阻止 Windows 7 PC 进入休眠状态 - 2

    我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0

  2. ruby-on-rails - 如何优雅地重启 thin + nginx? - 2

    我的瘦服务器配置了nginx,我的ROR应用程序正在它们上运行。在我发布代码更新时运行thinrestart会给我的应用程序带来一些停机时间。我试图弄清楚如何优雅地重启正在运行的Thin实例,但找不到好的解决方案。有没有人能做到这一点? 最佳答案 #Restartjustthethinserverdescribedbythatconfigsudothin-C/etc/thin/mysite.ymlrestartNginx将继续运行并代理请求。如果您将Nginx设置为使用多个上游服务器,例如server{listen80;server

  3. ruby - 在 Windows 机器上使用 Ruby 进行开发是否会适得其反? - 2

    这似乎非常适得其反,因为太多的gem会在window上破裂。我一直在处理很多mysql和ruby​​-mysqlgem问题(gem本身发生段错误,一个名为UnixSocket的类显然在Windows机器上不能正常工作,等等)。我只是在浪费时间吗?我应该转向不同的脚本语言吗? 最佳答案 我在Windows上使用Ruby的经验很少,但是当我开始使用Ruby时,我是在Windows上,我的总体印象是它不是Windows原生系统。因此,在主要使用Windows多年之后,开始使用Ruby促使我切换回原来的系统Unix,这次是Linux。Rub

  4. ruby - 使用 `+=` 和 `send` 方法 - 2

    如何将send与+=一起使用?a=20;a.send"+=",10undefinedmethod`+='for20:Fixnuma=20;a+=10=>30 最佳答案 恐怕你不能。+=不是方法,而是语法糖。参见http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html它说Incommonwithmanyotherlanguages,Rubyhasasyntacticshortcut:a=a+2maybewrittenasa+=2.你能做的最好的事情是:

  5. Vscode+Cmake配置并运行opencv环境(Windows和Ubuntu大同小异) - 2

    之前在培训新生的时候,windows环境下配置opencv环境一直教的都是网上主流的vsstudio配置属性表,但是这个似乎对新生来说难度略高(虽然个人觉得完全是他们自己的问题),加之暑假之后对cmake实在是爱不释手,且这样配置确实十分简单(其实都不需要配置),故斗胆妄言vscode下配置CV之法。其实极为简单,图比较多所以很长。如果你看此文还配不好,你应该思考一下是不是自己的问题。闲话少说,直接开始。0.CMkae简介有的人到大二了都不知道cmake是什么,我不说是谁。CMake是一个开源免费并且跨平台的构建工具,可以用简单的语句来描述所有平台的编译过程。它能够根据当前所在平台输出对应的m

  6. 深度学习部署:Windows安装pycocotools报错解决方法 - 2

    深度学习部署:Windows安装pycocotools报错解决方法1.pycocotools库的简介2.pycocotools安装的坑3.解决办法更多Ai资讯:公主号AiCharm本系列是作者在跑一些深度学习实例时,遇到的各种各样的问题及解决办法,希望能够帮助到大家。ERROR:Commanderroredoutwithexitstatus1:'D:\Anaconda3\python.exe'-u-c'importsys,setuptools,tokenize;sys.argv[0]='"'"'C:\\Users\\46653\\AppData\\Local\\Temp\\pip-instal

  7. ruby - 如何计算 Liquid 中的变量 +1 - 2

    我对如何计算通过{%assignvar=0%}赋值的变量加一完全感到困惑。这应该是最简单的任务。到目前为止,这是我尝试过的:{%assignamount=0%}{%forvariantinproduct.variants%}{%assignamount=amount+1%}{%endfor%}Amount:{{amount}}结果总是0。也许我忽略了一些明显的东西。也许有更好的方法。我想要存档的只是获取运行的迭代次数。 最佳答案 因为{{incrementamount}}将输出您的变量值并且不会影响{%assign%}定义的变量,我

  8. arrays - Ruby 数组 += vs 推送 - 2

    我有一个数组数组,想将元素附加到子数组。+=做我想做的,但我想了解为什么push不做。我期望的行为(并与+=一起工作):b=Array.new(3,[])b[0]+=["apple"]b[1]+=["orange"]b[2]+=["frog"]b=>[["苹果"],["橙子"],["Frog"]]通过推送,我将推送的元素附加到每个子数组(为什么?):a=Array.new(3,[])a[0].push("apple")a[1].push("orange")a[2].push("frog")a=>[[“苹果”、“橙子”、“Frog”]、[“苹果”、“橙子”、“Frog”]、[“苹果”、“

  9. ruby - 如何在 Ruby 中执行 Windows CLI 命令? - 2

    我在目录“C:\DocumentsandSettings\test.exe”中有一个文件,但是当我用单引号编写命令时`C:\DocumentsandSettings\test.exe(我无法在此框中显示),用于在Ruby中执行命令,我无法这样做,我收到的错误是找不到文件或目录。我尝试用“//”和“\”替换“\”,但似乎没有任何效果。我也使用过系统、IO.popen和exec命令,但所有的努力都是徒劳的。exec命令还使程序退出,这是我不想发生的。提前致谢。 最佳答案 反引号环境就像双引号,所以反斜杠用于转义。此外,Ruby会将空格解

  10. += 的 Ruby 方法 - 2

    有没有办法让Ruby能够做这样的事情?classPlane@moved=0@x=0defx+=(v)#thisiserror@x+=v@moved+=1enddefto_s"moved#{@moved}times,currentxis#{@x}"endendplane=Plane.newplane.x+=5plane.x+=10putsplane.to_s#moved2times,currentxis15 最佳答案 您不能在Ruby中覆盖复合赋值运算符。任务在内部处理。您应该覆盖+,而不是+=。plane.a+=b与plane.a=

随机推荐