Hi,
I just installed (in /opt folder) Node.js server and it works fine. I installed a Socket.io and Express as it described it Readme:
1. Install npm (Node Package Manager)
curl http://npmjs.org/install.sh | sudo sh
2. Use npm to install Socket.IO and Express, and symlink into this folder.
> npm install socket.io express
> ln -s /path/to/socket/io/install/socket.io /path/to/your/nodejs/module/socket_io/socket.io
(for me is <strong>ln -s /opt/node_modules/socket.io /var/www/mysite.com/site/sites/all/modules/nodejs/socket_io/socket.io</strong>)
if you installed node.js in ~/local/src, the symlink will be
> ln -s /usr/local/lib/node/socket.io/ socket_io
In my /var/www/mysitecom/site/sites/all/modules/nodejs/socket_io folder there is 2 files:
1. Symlink to the /opt/node_modules/socket.io - is that right?
2. Index.js (from /opt/node_modules/socket.io) - is that right?
When I tried to run: /var/www/madfanboy.com/site/sites/all/modules/nodejs/server.js by node server.js I got:
Error: Cannot find module 'express'
I'm sure that I did something wrong with the symlinks. But I'm a newbie and don't know what exactly.
Right now I can find socket.io here:
/root/.npm/socket.io
/opt/node_modules/socket.io
Maybe somebody can help me? My server is Debian 6.
Thanks!!!
Comments
Comment #1
julien CreditAttribution: julien commentedHi,
Try to do in the module folder :
I usually dont do the symlink and it install everything in the node_modules folder. After run node server.js from the module folder.
Comment #2
superfedya CreditAttribution: superfedya commentedIn /opt/node_modules or /www/mysite.com/site/sites/all/modules/nodejs/socket_io or /www/mysite.com/site/sites/all/modules/nodejs?
Thnaks!
Comment #3
superfedya CreditAttribution: superfedya commentedWhat exactly I must put in: sites/all/modules/nodejs/socket_io folder?
In my /opt/node_modules folder there is 3 sub-folder:
.bin
express
socket.io
When I try to run server.js from there I got:
Failed to read config file, exiting: Error: EBADF, Bad file descriptor '/opt/node_modules/nodejs.config.js'
I moved nodeja.config.js there and got:
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object # has no method 'get'
at Object. (/opt/node_modules/server.js:626:4)
at Module._compile (module.js:411:26)
at Object..js (module.js:417:10)
at Module.load (module.js:343:31)
at Function._load (module.js:302:12)
at Array. (module.js:430:10)
at EventEmitter._tickCallback (node.js:126:26)
I moved /opt/node_modules/express to /var/www/mysite.com/site/sites/all/modules/nodejs
And /opt/node_modules/socket.io to the same location.
No results :(
Or maybe it'll be more simple like this:
I downloaded the Node.js there: /opt/node-v0.4.12
./configure
make
sudo make install
The server is working fine.
Drupal module is here: /var/www/mysitecom/site/sites/all/modules/nodejs
What I need to do next? My system is Debian 6.
Thanks!!!
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedi'll update the README.txt today, its totally out of date.
Comment #5
superfedya CreditAttribution: superfedya commentedMaybe this info will help:
whereis npm: /usr/local/bin/npm
whereis node: /usr/local/bin/node /usr/local/lib/node
This command: mkdir -p ~/local/src && cd ~/local/src && git clone git://github.com/joyent/node.git && cd node && ./configure && make && sudo make install download node 0.6.x and: Error: npm doesn't work with node v0.6.1-pre
upd:
beejeebus thanks! ill waiting!
Comment #6
superfedya CreditAttribution: superfedya commentedbeejeebus
Any news?
Thanks
Comment #7
evvolutions CreditAttribution: evvolutions commentedYou need to do a series of steps to install node.js in a Ubuntu server. I've listed below the steps.
1.) Install Node.js
2.) Installing Node Package Manager (NPM)
3.) Things to note after NPM install -
For example you are in a folder /user_name/ and you issue command
the above command will create a folder named "node_modules" and inside the folder there will be a folder called socket.io
Now you can create an installtion of drupal in any folder like /user_name/drupal-7.x
Explaination:
The node v-0.4.x will search for node_modules in your node_path or a folder for node_modules.
When issued command node app.js it will search for current folder for node_modules for "require('socket.io')" if not found it will search the next underlying directory and so on. If its not finding until the root directory it will throw an error.
Hope the above code is more clear..!!!
cheers :) and happy community coding :)