While trying to install `apt-get install npm`, it shows an error

Err:3 http://in.archive.ubuntu.com/ubuntu cosmic/main amd64 linux-libc-dev amd64 4.18.0-10.11 Bad header line Bad header data [IP: 192.168.1.151 808] Get:4 http://in.archive.ubuntu.com/ubuntu cosmic/main amd64 libc6-dev amd64 2.28-0ubuntu1 [2,587 kB]

Any solution to circumvent this roadblock would be appreciated.

1 answer

  • answered 2018-11-08 07:10 Rajneesh Shukla

    if you use apt-get for install nodejs you can switch version easily:

    $ sudo apt-get install npm # install npm
    $ sudo npm install -g  n  # install n nodejs version switcher as global package.
    $ sudo n stable # install latest stable version.
    install more version: [exmp: 9.1.0]
    
    $ sudo n 9.1.0