3

When I try to install less css compiler under my Ubuntu 13.10 box I get following message and lescss don't working. In what way I can fix the problem? I execute:

sudo npm install -g less

After this I get e list with OK messages:

npm http 304 https://registry.npmjs.org/cryptiles
npm http 304 https://registry.npmjs.org/ctype/0.5.2
npm http 304 https://registry.npmjs.org/combined-stream
npm http GET https://registry.npmjs.org/delayed-stream/0.0.5
npm http 304 https://registry.npmjs.org/sntp
npm http 304 https://registry.npmjs.org/boom
npm http 304 https://registry.npmjs.org/delayed-stream/0.0.5

And list finished with following:

/usr/local/bin/lessc -> /usr/local/lib/node_modules/less/bin/lessc
[email protected] /usr/local/lib/node_modules/less
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

After this when I tried the following commands:

echo "@foo: 25px; #foobar{font-size: @foo};" > style.less
sudo lessc ./style.less ./style.css

I get the following error:

/usr/bin/env: node: No such file or directory

After I executed

ln -s /usr/bin/node /usr/local/bin/nodejs

and created symlinks there is no errors but lessc compiler don't working properly. I have created file to test. It content is:

 cat style.less 
@color: #4D926F;

#header {
  color: @color;
}
h2 {
  color: @color;
}`

and after trying

lessc styles.less > styles.css

There is created file - styles.css but the file is empty. I also try commands that I tryed before - see top on the post. But it not working. I would be very grateful for any advice and recommendations.

Best regards.

2
  • "I get the following message": what message? I see no error messages in your question. Also, what does "not working" mean? What are the symptoms?
    – terdon
    Apr 14, 2014 at 13:46
  • The question is edited.
    – George
    Apr 14, 2014 at 14:03

3 Answers 3

7
sudo ln -s /usr/bin/nodejs /usr/bin/node

Is what I did the other way seems to make a broken symlink for me.

This should prove all is working:

file $(which node)
/usr/bin/node: symbolic link to `/usr/bin/nodejs'

(note it doesn't say broken symbolic link)

Unfortunaltly I believe terdon's answer will actually stop the correct answer from working

# Don't do this:
sudo apt-get install node
file $(which node)
/usr/sbin/node: symbolic link to `ax25-node' 

apt-cache show node|grep Description-en
Description-en: Amateur Packet Radio Node program (transitional package)

(you want nodejs not Amateur Packet Radio I would think :) )

Uninstalling that node package should fix that problem

-End of useful info (unless you like ham radio)-


Edit: So the whole problem is that there was a package in Debian called 'node' already, Debian got upset at nodejs for not checking if a command named node wasn't already taken by another package (the ham radio program). So Debian effectively broke node programs because packages like less that look for a command named 'node'.

If you happen to use the ham radio package then instead of making the symlink you could change the shebang line in the lessc file to #!/usr/bin/env nodejs as terdon said in the comments below.

Note if you use other npm packages you may have to change a lot of shebang lines so only do this if you really use ham radio :)

Update: Ok so I read yorodm's link a bit more and debian has changed the Ham radio package to https://packages.debian.org/sid/ax25-node Trusty actually uses this!

So if you use ham radio just delete /usr/bin/node which is a symlink to /usr/bin/ax25-node replace it with a node symlink to /usr/bin/nodejs as at the top of this answer, you will need to do this again if you just install ham radio as it overrides.

Now if you want ham radio use 'ax25-node' as the command :D

Bottom line it's easy to use 'node' for nodejs to spite the politics.

Update for the record/archive

This post was mainly for people who had installed the official sudo apt-get install nodejs package in Ubuntu 14.04 (trusty Tahr) which removed compatibility by changing the command 'node' to 'nodejs'.

At the time the actual better solution would have been to install Chris Lea's ppa on launchpad but now he has moved that again to a different location and this is the best (no fussing with symlinks) out of the box solution by Chris Lea:

curl -sL https://deb.nodesource.com/setup | sudo bash -

(Now designed for both Debian and Ubuntu)

References: https://github.com/joyent/node/wiki/installing-node.js-via-package-manager https://nodesource.com/blog/chris-lea-joins-forces-with-nodesource

That's what joyent is linking on there website so that's what I'm using :D

5
  • askubuntu.com/a/104452 (less via apt) and stackoverflow.com/a/23084499 (npm/nodejs from tar) seem like alternatives (haven't tried)
    – sabgenton
    Jun 16, 2014 at 7:35
  • +1 and thanks again for pointing out the error in mine. I think, however, that it would be better to change the shebang line in ` lessc` to #!/usr/bin/env nodejs, that way if the OP ever wants to install the ham radio node package, there won't be conflicts.
    – terdon
    Jun 16, 2014 at 12:21
  • Unless debian people convince the node people to change the exe to nodejs for all OS's you'll be changing scripts for everything you npm install that needs it. Be nice if they did :)
    – sabgenton
    Jun 17, 2014 at 12:44
  • Good point. In that case, I'd just ln -s /usr/bin/nodejs ~/bin/node. That way env will find it correctly and it won't be overwritten by the node package.
    – terdon
    Jun 17, 2014 at 12:54
  • You don't have to now see my update, ax25-node is the new command for the ham radio package :D
    – sabgenton
    Jun 18, 2014 at 3:49
2

According to this Debian changed the name of the node binary to nodejs (that is /usr/bin/node and /usr/bin/nodejs) To fix any issues in your code just make a symlink in /usr/local/bin

sudo ln -s /usr/bin/node /usr/local/bin/nodejs
2
  • I have created sumlink and this helps. There is other problem. The question is edited.
    – George
    Apr 15, 2014 at 6:32
  • 2
    @George if this answer helped you, it would be nice of you to upvote it and/or accept it.
    – terdon
    Apr 15, 2014 at 12:37
2

If you install nodejs from official repository, you can also install nodejs-legacy package, this will add the missing node command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .