Node.js + Socket.io + Windows 7 / 8?

2020-05-31 22:41发布

I've been searching everywhere, but can't seem to find a solution. Is it possible to install Socket.io on Node.js on Windows 7?

If not, is there some sort of alternative, or do you know of any future Windows support?

Usually the Node.js package manager is used, however I can't find a way of installing that on Windows. http://npmjs.org/

I'm currently using Node.exe (not running it through Cygwin).

This is how I'd imagine it would be installed on Windows, if NPM worked:

npm install socket.io

Node Package Manager now works on Windows 7

Simply install Node.js and type npm install socket.io into the Windows console and look in C:\Users\[insert username]\node_modules.

11条回答
Deceive 欺骗
2楼-- · 2020-05-31 23:04

For me, downloading the modules directly from GitHub and putting them in the "node_modules" directory works. AFAIK that's what npm does. It works both if you put it in your user directory, or in the same directory as node.exe.

Too bad there's no Windows port for npm, since there's almost no porting needed to be done, and that node comes as a stand-alone executable instead of an installer, like Python.

查看更多
一夜七次
3楼-- · 2020-05-31 23:07

Now that Node.js version 0.6.0 is available, and it seems pretty stable so far, I'm going to suggest using it if you're planning on developing on Windows.

http://nodejs.org/download/

查看更多
孤傲高冷的网名
4楼-- · 2020-05-31 23:07

npm runs on Node.js. If you are having problems running npm, then you should also be having problems with Node.js. Assuming you are running Node.js through Cygwin, then you should be able to run

node npm install socket.io

(Which is the same as npm install socket.io)

Also.

Npm is just the Node.js package manager. There is nothing that it provides that you can't get from the repositories themselves. It is just, for obvious reasons, a lot easier to use npm.

If you want the socket.io included, then just create a node_modules directory inside of your /lib directory or wherever your project is, and then clone the socket.io to it.

https://github.com/LearnBoost/socket.io


Edit

The OP indicated that he is using node.exe. There is no way currently as of 1st September 2011 to use npm with node.exe. It is currently on the node.exe roadmap and will hopefully be completed soon, but not as of today. (Check the mailing list if you want to be updated).

查看更多
狗以群分
5楼-- · 2020-05-31 23:07

I faced the same problem and edited the Socket.IO library to work on windows. Details of the same you can find here.

查看更多
Lonely孤独者°
6楼-- · 2020-05-31 23:10

Until NPM is built for Windows you'll need to download the packages manually and create the node_modules folder structure in the node.exe folder. Follow this post.

查看更多
登录 后发表回答