简体   繁体   中英

trouble installing the latest version of npm on arch linux

The version of node on pacman , the pacage manager on Arch linux, is not the latest one- but for my programme I need the latest version.

To solve this I tried to download the source code , downloading the tar ball and then unpacking it and trying to build it.

But when I got inside of the folder, and then looked on the build instructions on github , the commands to build, ie

$ ./configure
$ make
$ [sudo] make install

didn't work- so I cloned the github project , and followed those instructions above- but all I got was this error:

在此输入图像描述

how can I install the latest version of node, ie node v 4.4.3+?

Classical python 2 vs. python 3 problem. Arch Linux uses python 3 by default but the except <exception>, <variable>: syntax has been dropped in favour of except <exception> as <variable>: in python 3.

Full example:

  • python 2

     try: print 'yay' except ValueError, e: print e 
  • python 3

     try: print('yay') except ValueError as e: print(e) 

The configure script for npm is written in python 2. But, as I said above, Arch uses python 3 as python . You need to change the first line of the configure script from:

#!/usr/bin/env python

to:

#!/usr/bin/env python2

You may need to install python 2 , since it does not come with Arch by default:

pacman -S extra/python2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM