skip to Main Content

im trying to install NodeJS LTS on my vm. But ubuntu (22.04) throws an error

Error:

root@web-server ~/server# sudo apt list nodejs
Listing... Done
nodejs/unknown 18.12.0-deb-1nodesource1 arm64
N: There is 1 additional version. Please use the '-a' switch to see it
root@web-server ~/server# sudo apt install nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  javascript-common libc-ares2 libjs-highlight.js libnode72
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 93 not upgraded.
Need to get 0 B/27.8 MB of archives.
After this operation, 180 MB of additional disk space will be used.
(Reading database ... 83553 files and directories currently installed.)
Preparing to unpack .../nodejs_18.12.0-deb-1nodesource1_arm64.deb ...
Unpacking nodejs (18.12.0-deb-1nodesource1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_18.12.0-deb-1nodesource1_arm64.deb (--unpack):
 trying to overwrite '/usr/share/systemtap/tapset/node.stp', which is also in package libnode72:arm64 12.22.9~dfsg-1ubuntu3
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs_18.12.0-deb-1nodesource1_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@web-server ~/server [100]#

I tried to delete and install it again multiple times bu nothing happens

2

Answers


  1. Follow this link: Github Error solved link

    and reinstall nodejs with the following command as given below

    Installed Nodejs version-12.22.9 Successfully on my Ubuntu 22.04

    sudo apt update
    sudo apt install nodejs
    

    Press Y when prompted to confirm installation. If you are prompted to restart any services, press ENTER to accept the defaults and continue. Check that the install was successful by querying node for its version number:

    node -v
    

    Output

    v 12.22.9
    
    Login or Signup to reply.
  2. Try this:

    $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh
    
    $ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    
    $ source ~/.bashrc
    
    $ nvm list-remote
    
    $ nvm install v16.14.0  
    
    $ nvm install lts/fermium
    
    $ node -v
    

    These steps will install nodejs v14.19.0.
    There is a very helpful link to setup or update nodejs on Ubuntu 22.4

    https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-22-04

    you can visit it for more details.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search