WebFaction
Community site: login faq
0
1

I am trying to install a css less compiler, lessc. I have found a wiki online that explains how to do just that on a debian server. I have followed the instructions (with a few tweaks to get all the steps to work) and I get this message:

[xxxxxx@webXXX ~]$ lessc
/usr/bin/env: node: No such file or directory

What I understand from that is that the lessc command is working but it depends on the node command to work and it's not available.

Ultimately, I'd like to understand (1) the process of installing external packages, (2) where to put them, (3) where to find them, (4) how to remove them from your environment, all that, within the context of webfaction. This link here answers alot of those questions, but some pieces are missing.

Anyone who has had experience installing css compilers (less, sass) and node could give me a hand?

asked 19 Sep '12, 17:18

mjlavoie
1222
accept rate: 0%


Overview

The 'lessc' program is actually a javascript file which is run via node, so you'll first need to install node using this related community post, or manually using our home-install guide.

Then, once that's done, grab Less CSS.

The installation procedure for lessc is similar to the home-install guide, except that it seems that less CSS doesn't use the "./configure" step. After installing node, you should be able to just run "make" or use bin/lessc directly.

Guide

Install node.js and then lessc.

Recently node is much easier to install than in the past, so we can just install it as any other normal source-code application:

# create ~/src, where we keep all source code
mkdir -p $HOME/src

###########################################################
# node 0.8.9
###########################################################
cd $HOME/src
wget 'http://nodejs.org/dist/v0.8.9/node-v0.8.9.tar.gz'
tar -xzf node-v0.8.9.tar.gz
cd node-v0.8.9
./configure --prefix=$HOME
make                         # build it
make install                 # install it

# clear the shell hash so we know we're using the correct path
hash -r
which node    # should be ~/bin/node

###########################################################
# Less CSS
###########################################################
cd $HOME/src
git clone 'https://github.com/cloudhead/less.js.git'
cd less.js
make                         # build it
cp -r ./bin/* $HOME/bin/     # install binaries
cp -r ./lib/* $HOME/lib/     # install libraries

# clear the shell hash so we know we're using the correct path
hash -r
which lessc        # should be ~/bin/lessc

Discussion

Installing software has three parts. First, you configure it, which means changing and setting the compile-time options. Many pieces of software can be compiled in different ways, with different internal paths, and with certain options like multithreading turned on or off. The ./configure stage does this, and when installing node, we used ./configure --prefix=$HOME. Setting the --prefix is setting a compile-time option which defines the internal paths hard-coded into the binary itself. Running the ./configure step generates a Makefile.

Some programs are so simple that don't have any compile-time options at all, or they have just a handful which can be manually set inside of the Makefile itself. These programs don't have a ./configure step. You can recognize them because they don't have a configure script inside of the source directory, but directly have a Makefile instead. lessc was one such example.

The next step is to compile the software. This is what the make command does. When you type make, it compiles the software, putting all of the compiled programs into subdirectories of your current working directory. The make command uses the Makefile as its recipe for how to do this.

The final step is to install the software. Installation usually means nothing more than copy-pasting those binaries into their new permanent locations. In the first example here where we installed node, the make install step knows about the --prefix we set during the configure stage, so just typing make install copies the compiled files to where they can be run. In our case, that puts node inside of $HOME/bin. But you should also be aware that it put a library inside of your $HOME/lib directory too.

The lessc program didn't have any such make install mode. You can try typing make install to see if it works - it doesn't, in this case, so we just do a manual install by copying the binaries and libraries to $HOME/bin and $HOME/lib respectively. To "uninstall" a program, delete the files you installed.

There is a lot more to installation than this. For example, sometimes some software needs to compile in dependencies for other software, which is where the CPPFLAGS, LDFLAGS come into play. And sometimes programs need to have your $HOME/lib on the library path in order to function when you try to execute them -- and that's what LD_LIBRARY_PATH is for. These environment variables are covered briefly in our documentation.

If you're looking for in-depth knowledge and examples about compiling and installing software on linux, the book How Linux Works by Brian Ward is the best material on the subject that I've seen, so I'd strongly recommend it as the best place to start to really understand what's going on.

Hope that helps!

permanent link

answered 19 Sep '12, 20:32

ryans ♦♦
5.0k93160
accept rate: 43%

edited 14 Jan '13, 22:25

You sir are a gentleman! I really appreciate the (very complete) answer you took the time to write.

In the set of instructions provided, "which node", instead of the expected results outputs as follows:

[xxxxxxxx@xxxxxx node-v0.8.9]$ which node /usr/bin/which: no node in (/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/dell/srvadmin/bin:/home/xxxxxxxx/bin)

Ok, it's not there. Well perhaps creating a soft link to out/Release/node in ~/bin/ would work since installing is sometimes a matter of copying bin and lib in the right folders, so I did:

[xxxxxxxx@xxxxxx node-v0.8.9]$ ln -s out/Release/node ../../bin/node [xxxxxxxx@xxxxxx node-v0.8.9]$ ll ../../bin/

Listing the contents of bin prints out "node -> out/Release/node" all in red. Trying "which node" gives the same results as before. I am stumped.

(20 Sep '12, 20:14) mjlavoie

It is difficult to see why it is failing from here. It is likely related to the paths, and we could investigate more with a support ticket.

(20 Sep '12, 23:45) johns ♦♦

Thank you very much for this informative write-up. This helped me a lot!

(11 Jul '13, 13:41) vcatalano
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×67
×15
×4
×3
×3

question asked: 19 Sep '12, 17:18

question was seen: 14,286 times

last updated: 22 Aug '15, 11:49

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM