The node.js module (www.drupal.org/project/nodejs) is a great way to get node.js working with your Drupal installation. Although the README.txt file is verbose, I had problems getting everything working. Below are instructions that I believe are a little clearer.
- Make sure your system has the programs that node.js needssudo apt-get install build-essential git curl openssl libssl-dev -y
- Install node.jsmkdir -p ~/local/src
cd ~/local/src
git clone https://github.com/joyent/node.git
cd node
./configure- If openssl is showing as not found:sudo apt-get install pkg-config
pkg-config openssl --cflags --libs
./configure - Now you should run make and make installmake && make install
- If openssl is showing as not found:
- Run
- If npm install give you multiple errors about the connect or express modules then you probably installed an unstable version on node.js. Refer the the Problems section below to get this fixed!
- Enable the Nodejs Integration module from your drupal site or using drush en nodejs
- You should also enable the Nodejs Config module for clearer config options (drush cc all when enabled).
- Host, by default, is set to localhost. If you are not working locally set it to your sites IP address.
- In your nodejs module directory, copy nodejs.config.js.example to nodejs.config.js
- cp nodejs.config.js.example nodejs.config.js.
- If you used the Nodejs Config module, overwrite nodejs.config.js with the output it generated for you.
- Run the command:node server.js
If you don't get an error here you are done! The output I received was "info - socket.io started" so I know the server was running.
Problems
If you tried to run npm install and receive multiple error messages then you probably have an unstable version. Visit http://nodejs.org/#download and download the latest stable version. Unzip and untar it in ~/local/src/ (tar -zxvf [filename]). remove your previous node directory and rename your new directory "node".
./configure
make && make install
make && make install
Now repeat step 3 above. If you still are getting errors with connect and/or express, download the suggested version of each package:
The error message will say something like requires connect@'>=1.5.7' this means you should run the command
The error message will say something like requires connect@'>=1.5.7' this means you should run the command
npm install connect@1.5.7
If you get an error here saying that your version of node is not compatible, then you still have an unstable version!
No comments:
Post a Comment