Install latest nodejs version in ubuntu 14.04

前端 未结 13 1250
北恋
北恋 2020-12-12 13:50

This is the way I installed nodejs in ubuntu 14.04 LTS:

sudo add-apt-repository ppa:chris-lea/node.js

sudo apt-get install nodejs

When I c

13条回答
  •  误落风尘
    2020-12-12 14:17

    There is an issue with node and npm update in Ubuntu14.04 LTS 64 bit OS. Since Google Chrome repository no longer provides 32-bit packages, 64-bit Ubuntu/Debian users will notice an error when updating the software sources, which looks as follows:

    Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release Unable to find expected entry 'main/binary-i386/Packages' in Release file (Wrong sources.list entry or malformed file) Some index files failed to download. They have been ignored, or old ones used instead.

    So to fix this issue, the repository must be specifically set for 64-bit only. This can be done by the command

    sudo sed -i -e 's/deb http/deb [arch=amd64] http/' "/etc/apt/sources.list.d/google-chrome.list"
    

    i,e You should set it for 64 bit only before installing node. So the exact procedure to install latest node and npm will be

    sudo sed -i -e 's/deb http/deb [arch=amd64] http/' "/etc/apt/sources.list.d/google-chrome.list"
    
    curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
    
    sudo apt-get install -y nodejs
    

    I had such an issue and got this solution from here. Hope this will help someone.

提交回复
热议问题