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

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.

I am confirming that npm install socket.io works perfectly with Node.js 0.6.10 on Windows 7 (remember to run cmd as Administrator).

For anyone who is having trouble getting Node.js and socket.io working on Windows...
There is the nodejs-win project on Google Code.
http://code.google.com/p/nodejs-win/downloads/detail?name=node_setup_0.5.6.7.exe&can=2&q=
And here is a video that shows the basics of using it.
Node.JS & Socket.IO Chat System in Windows

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/

Either use a Linux box or git clone the socket.io repository and require it from a local path.
You will have to copy the entire socket.io library into, for example, lib/socket.io/
Then var io = require("./lib/socket.io/index.js

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).

Since the 0.6.6 version (as far as I remember) Node.js has a normal version for Windows, and after installing it a npm.exe file appears in the install directory, not sure how exactly I was running it, maybe something like node npm install socket.io.
Or maybe npm install socket.io. If none of these works, try to execute npm by typing full path to it (unless you have added a system variable for the path). For the record - I have successfully installed sokcet.io on Windows 7 via npm :)

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.

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.

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

I had the same problem with Node.js v10.22 on Windows 7 - this worked for me:
npm install socket.io#0.8.4

Create a file called package.json in your project directory with the following.
{
"name": "project name",
"description": "project description,
"version": "0.0.1",
"dependencies": {
"express": "2.4.6",
"socket.io": "version"
}
}
Then run the npm install

Related

react native is not set up after setting up the PATH variable

I am setting up react native on mac. I have installed node along with npm.
node version is v6.11.4
npm version is 5.4.2
I have install react native, command shown on the below image. And also export the PATH, then also it shows an error that react-native command not found. Could anyone help?
After running npm install -g react-native --verbose, it shows following:
I believe the command to get react-native-cli version is react-native -version which will show CLI version and the version of any react-native project directory you are in
I've seen this very error happening to a colleague of mine back in India. For some reason their ISP restricted the network to a level they couldn't access the NPM registry fully and the only way around it at that time was to use a VPN. Sadly I can't provide you any more info as this happened a couple of years ago.
You may want to change your DNS settings to override your ISPs' to see whether this helps but the reason why installation of react-native-cli is failing is that you can't access the NPM registry so it's a problem with your network provider rather than your machine.

Ugly output when running NPM commands from Windows

I have manually installed "node.exe" (0.10.36 x64) & NPM Zip (1.4.12) under Windows 7.
When I run a NPM command (from cmd, powershell or Eclipse TCF terminals), it prints a lot of a new line with single character from this list: -\|/.
However, it doesn't with Eclipse console.
It uselessly fills the console and makes difficult to see messages, especially when running some infinite running command like "karma start".
Is there any way to remove/fix these ugly output characters ?
It's an issue of "1.4.12" and "1.4.13" versions. Switch back to 1.4.10 (1.4.11 doesn't work at all on my computer) has solved the issue.
Another solution can be to upgrade to newer versions of npm simply running npm install npm --global. If want to easy switch NPM versions, just copy "npm.cmd" and "node_modules/npm" to another directory. Then from this directory, run npm install npm. Finally, update your PATH to take this directory in priority (or remove the old npm versions).
I have the same issue on Win 10. I was previously using v0.12.7 (I did not know why I used a so "old" version) then installed v4.2.2 which makes ugly output.
To solve this problem, I uninstalled v4.2.2 from Control Panel, removed npm and npm_cache folder from %APPDATA%, and finally removed all paths related to Node and npm from PATH environment variable.
Hope this could help someone.

Whats the best way to install nodejs in different location

By default nodejs is installed in /usr/local/bin/node but this location needs root access rights.
If I then install a global package like grunt-cli or a yeoman generator they also need root access rights. But I don't want to install all global packages with sudo.
So I tought why not install node and its global packages under something like opt/bin/node for example and give this location user access rights.
I used to download the installer from the nodejs website but with that I can't change location of the installation. So the question is:
How can I install nodejs in a differnt location than the default location on OSX and Windows?
Search engines are your friend.
Taken directly from the node docs:
On Windows
The http://nodejs.org/dist/latest/ directory contains executables of
the last version of Node.js engine (the engine only, i.e. without
npm):
32bit version: http://nodejs.org/dist/latest/node.exe
64bit version: http://nodejs.org/dist/latest/x64/node.exe
The http://nodejs.org/dist/npm/ directory contains the latest .zip
archive of npm (such as npm-1.1.16.zip when npm v1.1.16 was the
latest).
Manual installation steps:
Make a clean directory and add that directory to your system's PATH variable.
Download the latest node.exe to that directory.
Download the latest npm's .zip file and unpack its contents to the same directory.
Then, with the usual help of PATH, you'll be able to run scripts (node
scriptname.js) and install modules (npm install modulename) in any
directory.
...and just below that...
Installing on Mac
The http://nodejs.org/dist/latest/ directory contains the latest .pkg
package (such as node-v0.6.15.pkg when Node v0.6.15 was the latest).
we have discussed your issue with some unix guru´s.
in UNIX / MAC:
we believe the best way to install a node package "global" (non-project-specific respectively in your user environment) is to install node in folder
/opt/node or /home/user/.node and change the user-right, as you mentioned.
we believe its the wrong way, to change the /usr/ folder-rights or install global-packages with sudo.
in my case, i think the solution to change npm-config (mentioned in many other stackoverflow topics) did not changed anything, because node is still installed in /usr/bin.
still we belief, as a developer its more recommended to build such frequently updated applications like node by yourself instead of using the unix package manager. because mostly the resources ain't up to date.
I've had great success with nvm: https://github.com/creationix/nvm. It's a version manager for node, but one of the best parts of it (for me) is that it installs each version of node in your home directory. This means that your npm global install is also in this home directory. It's a Mac/Unix solution.
For Windows, though I've never tried it, there is the (similar) nvmw project: https://github.com/hakobera/nvmw.

Installed trigger app, installed node.js, trigger says it can't run npm on Mac

New Mac user account. I install the Trigger.io (TriggerToolkit) app for the Mac. It fires up a tab with the apps. I can run the iOS simulator from it - so it is plausibly working installation. I have installed node.js from the node.js website, using the Mac package.
I have node.js as /usr/local/bin/npm (version 1.1.43).
It is found when I type "npm" at a command line.
The path "/usr/local/bin" is on my $PATH.
"/usr/local/bin" is set in my /etc/paths file, system wide.
So the npm executable should be findable by any user, at any time (before or after login, running a terminal, etc).
When I use the web page for the web run, it's OK, until it tries to run npm.
[DEBUG] running run_web((), {})
[DEBUG] Running: npm install
[DEBUG] failed to run npm: do you have Node.js installed and on your path? while running run_web((), {})
[ERROR] failed to run npm: do you have Node.js installed and on your path?
I guess that the problem must be something to do with an assumption about the path for npm. What's the assumption? What can I symlink to make this work?
Note that npm is found by "forge run web". This is something specific to the way that TriggerToolkit.app is working.
Update: this is fixed as of v1.4.6:
http://docs.trigger.io/en/v1.4/release-notes.html#v1-4-6
Previous answer:
Unfortunately I think the error message here isn't great and reflects a general problem with starting the node app.
We are aware of one issue with dependencies which started occurring after Node 0.8. Can you check what Node version you have:
node --version
If it's 0.8, then a temporary workaround to this problem is to use the command line tools and:
forge build
Then manually update development/web/package.json to refer to express 2.5.10, then
forge run web
Sorry for the trouble, we'll report back here when that's fixed

Installing packages in native windows node.js

I am trying to get to grips with node.js, this looked like a fun tut http://net.tutsplus.com/tutorials/javascript-ajax/how-to-scrape-web-pages-with-node-js-and-jquery/ but I have only got the native windows version of node.js and I can't find a way to install any packages.
I have also looked at installing the binaries using chocalatey, but my version of vista doesn't have access to powershell. However, I do have a machine running windows 7 that I can switch to. If it isn't possible to install packages on windows version, I will switch to that machine and work through chocalatey.
Assuming you have the node.exe for Windows, npm has experimental support for windows. You can try working through the README.
Otherwise you can manually install packages on Windows. You will need to manually look at the package.json files for dependencies if you are going with option 2.
I have never tried it, but Scott Hanselman also has a post about getting node running on Windows.
Personally I have found its easier to just run a Linux VM since Windows support is kinda spotty right now.
The short answer is if you have git properly installed, you can open a cmd window, navigate to the directory containing node.exe, and run this:
git config --system http.sslcainfo /bin/curl-ca-bundle.crt
git clone --recursive git://github.com/isaacs/npm.git
cd npm
node cli.js install npm -gf
The more complete answer is that I posted a guide on how to install Node on Windows here. It also describes installing npm to manage packages. Let me know if it works for you.

Resources