-->

Nodejs ppa:Chris-lea/node.js fails

2019-02-21 07:25发布

问题:

Given a nodejs.makefile which contains the commands to install nodejs/npm & some npm packages, such:

nodejs:
    sudo add-apt-repository -y ppa:chris-lea/node.js   #install fresh nodejs
    sudo apt-get update
    sudo apt-get install -y nodejs
    sudo npm update -g npm                             #refresh npm
    sudo npm install -g topojson jsdom minimist        #install npm modules
    npm cache clean

I then run :

sudo make -f nodejs.makefile

but I get stopped at the sudo apt-get update level (command 2) by the error :

...     #some messages here
apt-get update
...       #many other messages there
Ign http://fr.archive.ubuntu.com trusty/universe Translation-en_US
W: Failed to fetch http://ppa.launchpad.net/jonoomph/openshot-edge/ubuntu/dists/trusty/main/binary-amd64/Packages  404  Not Found
W: Failed to fetch http://ppa.launchpad.net/jonoomph/openshot-edge/ubuntu/dists/trusty/main/binary-i386/Packages  404  Not Found
W: Failed to fetch http://ppa.launchpad.net/michael-gruz/canon/ubuntu/dists/trusty/main/binary-amd64/Packages  404  Not Found
W: Failed to fetch http://ppa.launchpad.net/michael-gruz/canon/ubuntu/dists/trusty/main/binary-i386/Packages  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
make: *** [nodejs] Error 100

After checking, it appears the "Error 100" is simply the error message of sudo apt-get update failing. But I can't get why this famous nodejs install way is actually failing, could it be the launchpad servers being out of order ?

How to make it works ?

回答1:

The project move from Launchpad to NodeSource. Information are here and here.

You can do this instead, in the CLI:

# runs new installer, remove Launchpad repository entry if it exists:
curl -sL https://deb.nodesource.com/setup | sudo bash -    
sudo apt-get -y install nodejs          # install nodejs
sudo npm install npm -g                 # update NPM to latest stable

If sudo apt-get -y install nodejs fails, try:

 sudo apt-get update
 sudo apt-get -y install nodejs --fix-missing


回答2:

There are now official instructions from joyent (primary nodejs backer). For Ubuntu:

sudo apt-get purge nodejs npm                               # clean up the place
curl -sL https://deb.nodesource.com/setup | sudo bash -     # add repository
sudo apt-get install -y nodejs                              # install both nodejs & npm

For other unix distributions, osx and windows see the link.