Re: [nodejs] SyntaxError: invalid syntax - while installing 0.8.1

2,474 views
Skip to first unread message

Ben Noordhuis

unread,
Jun 29, 2012, 9:23:23 PM6/29/12
to nod...@googlegroups.com
On Sat, Jun 30, 2012 at 3:19 AM, neojp <then...@gmail.com> wrote:
> Hey guys,
>
> I'm running Node 0.6.15 on CentOS with Python 2.4.3 and for some reason, I'm
> getting this weird error while trying to install 0.8.1
> Does anyone have any idea on what can I do about it?
>
> $ cd node-v0.8.1
> $ ./configure
>   File "./configure", line 266
>     o['default_configuration'] = 'Debug' if options.debug else 'Release'
>                                           ^
> SyntaxError: invalid syntax

You need to use python 2.6 or 2.7.

Ryan Schmidt

unread,
Jun 29, 2012, 9:27:40 PM6/29/12
to nod...@googlegroups.com

On Jun 29, 2012, at 20:23, Ben Noordhuis wrote:

> On Sat, Jun 30, 2012 at 3:19 AM, neojp wrote:
>>
>> I'm running Node 0.6.15 on CentOS with Python 2.4.3 and for some reason, I'm
>> getting this weird error while trying to install 0.8.1
>> Does anyone have any idea on what can I do about it?
>>
>> $ cd node-v0.8.1
>> $ ./configure
>> File "./configure", line 266
>> o['default_configuration'] = 'Debug' if options.debug else 'Release'
>> ^
>> SyntaxError: invalid syntax
>
> You need to use python 2.6 or 2.7.

Shouldn't the configure script print a friendlier message if a wrong version of python is used?


Ben Noordhuis

unread,
Jun 29, 2012, 9:43:50 PM6/29/12
to nod...@googlegroups.com
Chicken/egg problem. configure is a python script, it's the python
interpreter that raises the error.

I guess we could wrap it in a shell script that checks the python
version but I don't find that very appealing. The build requirements
are clearly documented in the README but that's not the main reason: I
don't like layers upon layers, it makes debugging harder.

Matt

unread,
Jun 29, 2012, 10:26:23 PM6/29/12
to nod...@googlegroups.com
On Fri, Jun 29, 2012 at 9:43 PM, Ben Noordhuis <in...@bnoordhuis.nl> wrote:
> Shouldn't the configure script print a friendlier message if a wrong version of python is used?

Chicken/egg problem. configure is a python script, it's the python
interpreter that raises the error.

I guess we could wrap it in a shell script that checks the python
version but I don't find that very appealing. The build requirements
are clearly documented in the README but that's not the main reason: I
don't like layers upon layers, it makes debugging harder.

Isaac Schlueter

unread,
Jun 29, 2012, 11:54:05 PM6/29/12
to nod...@googlegroups.com
Yeah, we could wrap it in a very simple Python script that checks the
version, and then pulls in the "real" configure script.

It's not great, but it'd be better than relying on bash or something.
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

r...@tinyclouds.org

unread,
Jun 30, 2012, 8:34:35 PM6/30/12
to nod...@googlegroups.com
On Fri, Jun 29, 2012 at 6:23 PM, Ben Noordhuis <in...@bnoordhuis.nl> wrote:
> You need to use python 2.6 or 2.7.

It would be preferable to support Python 2.5 in our build scripts if
possible. Does GYP?

Ben Noordhuis

unread,
Jun 30, 2012, 8:43:10 PM6/30/12
to nod...@googlegroups.com
Not anymore. They made 2.6 a requirement some months ago.

neojp

unread,
Jul 1, 2012, 12:09:22 AM7/1/12
to nod...@googlegroups.com
Thanks Ben, I'll update Python and let you know if this fixes my problem.

It is funny though, I couldn't find any requirements information on the site. Obviously I didn't look at the README.md on Github, but so far, I've installed node in so many boxes and never thought about what version of Python was required, or that Python was required at all.

I totally agree about not wanting to have a python version check wrapper on top of the real configure. But, having a requirements info in the download link at the website would have saved me some time.

Thank you guys, you rock the server side Javascript world.

Ben Noordhuis

unread,
Jul 1, 2012, 1:21:00 PM7/1/12
to nod...@googlegroups.com
That's a good idea. I've opened an issue for it[1].

[1] https://github.com/joyent/node/issues/3604

Ben Noordhuis

unread,
Oct 8, 2012, 7:26:35 PM10/8/12
to nod...@googlegroups.com
On Tue, Oct 9, 2012 at 1:07 AM, Dean Flory <deanfl...@gmail.com> wrote:
> I just received this after installing Python 2.7.3:
>
>> # ./configure
>> File "./configure", line 347
>> o['default_configuration'] = 'Debug' if options.debug else 'Release'
>> ^
>> SyntaxError: invalid syntax
>
>
> And I'm guessing it's playing a part in why I can't install the newest
> version of Node.js since I can't get past ./configure (where other
> packages/installs succeeded when ./configure was entered).

You may have installed python 2.7 but you're not using it, otherwise
you wouldn't be getting that error. :-)

Try this:

$ python2.7 configure
$ make PYTHON=python2.7

Replace python2.7 with whatever the binary is really called.
Reply all
Reply to author
Forward
0 new messages