NodeJS v0.4.0 on Arch Linux

As NodeJS v0.4.0 is out, I thought I’d have a play around with it (something I haven’t done in a very long time!)

Instantly I ran into problems:

$ ./configure
Traceback (most recent call last):
  File "/Users/greim/nodestuff/node/tools/waf-light", line 157, in
    import Scripting
  File "/Users/greim/nodestuff/node/tools/wafadmin/Scripting.py", line 146
    except Utils.WafError, e:
                         ^
SyntaxError: invalid syntax

I’m trying to install this on my Arch Desktop, which has Python version 3.1.3 installed. After some research I found that it was a compatibility issue between Python 2.x and 3.x.

I didn’t really want to remove Python 3 as I’d had dependency hell recently. Inspired by an answer on StackOverflow, I had a dig about in my /usr/bin directory to see if there was both Python v3 and Python v2 installed. Fortunately there was: /usr/bin/python2

Note: Following a comment by eveningsky below, there is a much easier way to work around the problem.

mkdir /tmp/bin
ln -s /usr/bin/python2 /tmp/bin/python
export PATH=/tmp/bin:$PATH

You can now carry on as normal. I have kept my nasty hack below just in case for some absurd reason the above doesn’t work for you.

Many thanks eveningsky!

Old Version

After some trial and error, all I had to do was to edit 2 files:

/tmp/node-v0.4.0/tools/waf-light

amending the first line to read:

#!/usr/bin/env python2

and once I had run ./configure edit the first line in the Makefile  to read:

WAF=python2 tools/waf-light

Simple!

Now I have Node JS version 0.4.0 running on my Arch box.

  • Ewqgewq

    cheers fella!

  • Ewqgewq

    cheers fella!

  • http://twitter.com/brentlintner Brent Lintner

    Thanks for saving me a lot of time. Kind of feel like I cheated though. :-)

  • http://twitter.com/brentlintner Brent Lintner

    Thanks for saving me a lot of time. Kind of feel like I cheated though. :-)

  • eveningsky

    I like this a lot better than editing individual scripts.

    Override “python” command with a temporary shortcut to python 2.

    mkdir /tmp/bin
    ln -s /usr/bin/python2 /tmp/bin/python
    export PATH=/tmp/bin:$PATH

    This uses python 2 until you kill the shell.

    • http://www.robsearles.com Rob Searles

      You, sir, are a genius!

      I’ve just had to install a fresh copy of Node.js on Arch and it works a treat – am updating my post now.

      Many thanks
      Rob

  • eveningsky

    I like this a lot better than editing individual scripts.

    Override “python” command with a temporary shortcut to python 2.

    mkdir /tmp/bin
    ln -s /usr/bin/python2 /tmp/bin/python
    export PATH=/tmp/bin:$PATH

    This uses python 2 until you kill the shell.

  • Nobody

    Thanks!

  • Nobody

    Thanks!

  • http://www.robsearles.com Rob Searles

    You, sir, are a genius!

    I've just had to install a fresh copy of Node.js on Arch and it works a treat – am updating my post now.

    Many thanks
    Rob

  • Richard Clifford

    Thanks for this! Much appreciated as I couldn’t figure out for the life of me why this wasn’t working.

  • Richard Clifford

    Thanks for this! Much appreciated as I couldn't figure out for the life of me why this wasn't working.