I would like to install a nodejs script (lessc) into a virtualenv.
How can I do that ?
Thanks
Natim
nodeenv (node. js virtual environment) is a tool to create isolated node. js environments. It creates an environment that has its own installation directories, that doesn't share libraries with other node.
Installing Node Version Manager Node Version Manager alias NVM is Node Module which helps to maintain multiple node versions in a same machine to manage various versions. `nvm` and `n` Node Module does not support windows. use below module.
A virtual environment is a tool that helps to keep dependencies required by different projects separate by creating isolated python virtual environments for them. This is one of the most important tools that most of the Python developers use.
I like shorrty's answer, he recommended using nodeenv, see: is there an virtual environment for node.js?
I followed this guide: http://calvinx.com/2013/07/11/python-virtualenv-with-node-environment-via-nodeenv/
All I had to do myself was:
. ../bin/activate # switch to my Python virtualenv first
pip install nodeenv # then install nodeenv (nodeenv==0.7.1 was installed)
nodeenv --python-virtualenv # Use current python virtualenv
npm install -g less # install lessc in the virtualenv
Here is what I used so far, but it may be optimized I think.
Install nodejs
wget http://nodejs.org/dist/v0.6.8/node-v0.6.8.tar.gz
tar zxf node-v0.6.8.tar.gz
cd node-v0.6.8/
./configure --prefix=/absolute/path/to/the/virtualenv/
make
make install
Install npm (Node Package Manager)
/absolute/path/to/the/virtualenv/bin/activate
curl https://npmjs.org/install.sh | sh
Install lesscss
npm install less -g
When you activate your virtualenv you can use lessc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With