Help installing nodejs

About programming and getting involved with Linux Mint development
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
axrusar
Level 7
Level 7
Posts: 1507
Joined: Sat Jan 30, 2021 5:30 pm

Help installing nodejs

Post by axrusar »

Guys. i am following the instructions to install nodejs in Mint 21 here: https://github.com/nodesource/distribut ... debinstall
I get an error at the end.

Code: Select all

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -

## Installing the NodeSource Node.js 18.x repo...


## Populating apt-get cache...

+ apt-get update
Hit:1 https://linux.teamviewer.com/deb stable InRelease
Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease                                                                
Hit:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease                                                        
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [99,8 kB]                         
Get:5 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]       
Ign:6 http://packages.linuxmint.com vanessa InRelease                                       
Hit:7 http://packages.linuxmint.com vanessa Release                                         
Fetched 210 kB in 1s (208 kB/s)                          
Reading package lists... Done

## You seem to be using Linux Mint version vanessa.
## This maps to Ubuntu "jammy"... Adjusting for you...

## Confirming "jammy" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_18.x/dists/jammy/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg >/dev/null

## Creating apt sources list file for the NodeSource Node.js 18.x repo...

+ echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x jammy main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x jammy main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...

+ apt-get update
Get:1 https://deb.nodesource.com/node_18.x jammy InRelease [4 563 B]
Hit:2 https://linux.teamviewer.com/deb stable InRelease                                                               
Get:3 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]                                             
Hit:4 http://archive.ubuntu.com/ubuntu jammy InRelease                                                         
Hit:5 http://archive.ubuntu.com/ubuntu jammy-updates InRelease                                                 
Get:6 https://deb.nodesource.com/node_18.x jammy/main amd64 Packages [774 B]   
Get:7 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [99,8 kB]                                   
Ign:8 http://packages.linuxmint.com vanessa InRelease                                        
Hit:9 http://packages.linuxmint.com vanessa Release       
Fetched 216 kB in 1s (220 kB/s)
Reading package lists... Done

## Run `sudo apt-get install -y nodejs` to install Node.js 18.x and npm
## You may also need development tools to build native addons:
     sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
     echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
     sudo apt-get update && sudo apt-get install yarn


axo@mint21VM:/etc/apt/sources.list.d$ sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 318 not upgraded.
Need to get 0 B/28,4 MB of archives.
After this operation, 184 MB of additional disk space will be used.
(Reading database ... 335992 files and directories currently installed.)
Preparing to unpack .../nodejs_18.13.0-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (18.13.0-deb-1nodesource1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_18.13.0-deb-1nodesource1_amd64.deb (--unpack):
 trying to overwrite '/usr/share/systemtap/tapset/node.stp', which is also in package libnode72:amd64 12.22.9~dfsg-1ubuntu3
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs_18.13.0-deb-1nodesource1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried a suggested fix there on github:
for anyone else with the same issue: delete the new package source:

Code: Select all

cd /etc/apt/sources.list.d 
sudo rm nodesource.list
update apt, fix the install, remove nodejs and the nodejs-doc packages

Code: Select all

sudo apt --fix-broken install
sudo apt update
sudo apt remove nodejs
sudo apt remove nodejs-doc
then use the instructions to install the latest node



Still no luck for me. I keep getting the same error.
I am working with a VM.

Code: Select all

inxi -Fzxxr
System:
  Kernel: 5.15.0-46-generic x86_64 bits: 64 compiler: gcc v: 11.2.0
    Desktop: Cinnamon 5.4.11 tk: GTK 3.24.33 wm: Mutter dm: LightDM
    Distro: Linux Mint 21 Vanessa base: Ubuntu 22.04 jammy
Machine:
  Type: Virtualbox System: innotek GmbH product: VirtualBox v: 1.2
    serial: <superuser required> Chassis: Oracle Corporation type: 1
    serial: <superuser required>
  Mobo: Oracle model: VirtualBox v: 1.2 serial: <superuser required>
    BIOS: innotek GmbH v: VirtualBox date: 12/01/2006
Battery:
  ID-1: BAT0 charge: 48.5 Wh (97.0%) condition: 50.0/50.0 Wh (100.0%)
    volts: 10.0 min: 10.0 model: innotek 1 serial: N/A status: N/A
CPU:
  Info: dual core model: Intel Core i7-8650U bits: 64 type: MCP
    arch: Coffee Lake rev: A cache: L1: 128 KiB L2: 512 KiB L3: 16 MiB
  Speed (MHz): avg: 2112 min/max: N/A cores: 1: 2112 2: 2112 bogomips: 8447
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3
Graphics:
  Device-1: VMware SVGA II Adapter driver: vmwgfx v: 2.19.0.0 ports:
    active: Virtual-1 empty: Virtual-2, Virtual-3, Virtual-4, Virtual-5,
    Virtual-6, Virtual-7, Virtual-8
    bus-ID: 00:02.0 chip-ID: 15ad:0405
  Display: x11 server: X.Org v: 1.21.1.3 driver: X: loaded: vmware
    unloaded: fbdev,modesetting,vesa gpu: vmwgfx display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1616x850 s-dpi: 96
  Monitor-1: Virtual1 mapped: Virtual-1 res: 1616x850 size: N/A
  OpenGL: renderer: SVGA3D; build: RELEASE; LLVM; v: 2.1 Mesa 22.0.5
    direct render: Yes
Audio:
  Device-1: Intel 82801AA AC97 Audio vendor: Dell driver: snd_intel8x0
    v: kernel bus-ID: 00:05.0 chip-ID: 8086:2415
  Sound Server-1: ALSA v: k5.15.0-46-generic running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes
  Sound Server-3: PipeWire v: 0.3.48 running: yes
Network:
  Device-1: Intel 82540EM Gigabit Ethernet driver: e1000 v: kernel port: d020
    bus-ID: 00:03.0 chip-ID: 8086:100e
  IF: enp0s3 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Device-2: Intel 82371AB/EB/MB PIIX4 ACPI type: network bridge
    driver: piix4_smbus v: N/A port: N/A bus-ID: 00:07.0 chip-ID: 8086:7113
  IF-ID-1: docker0 state: down mac: <filter>
Drives:
  Local Storage: total: 50.51 GiB used: 356.89 GiB (706.6%)
  ID-1: /dev/sda vendor: VirtualBox model: VBOX HARDDISK size: 50.51 GiB
    speed: 3.0 Gb/s serial: <filter>
Partition:
  ID-1: / size: 48.91 GiB used: 17.24 GiB (35.2%) fs: ext4 dev: /dev/sda3
  ID-2: /boot/efi size: 512 MiB used: 5.2 MiB (1.0%) fs: vfat
    dev: /dev/sda2
Swap:
  ID-1: swap-1 type: file size: 2 GiB used: 530.6 MiB (25.9%) priority: -2
    file: /swapfile
Sensors:
  Message: No sensor data found. Is lm-sensors configured?
Repos:
  Packages: 2217 apt: 2203 flatpak: 14
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/nodesource.list
    1: deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x jammy main
    2: deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x jammy main
  Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
    1: deb http://packages.linuxmint.com vanessa main upstream import backport
    2: deb http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse
    3: deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse
    4: deb http://archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse
    5: deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
  Active apt repos in: /etc/apt/sources.list.d/teamviewer.list
    1: deb [signed-by=/usr/share/keyrings/teamviewer-keyring.gpg] https://linux.teamviewer.com/deb stable main
Info:
  Processes: 220 Uptime: 51m Memory: 1.93 GiB used: 1.18 GiB (61.4%)
  Init: systemd v: 249 runlevel: 5 Compilers: gcc: 11.3.0 alt: 11 Shell: Bash
  v: 5.1.16 running-in: gnome-terminal inxi: 3.3.13
Last edited by LockBot on Sun Jul 16, 2023 10:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Linux Mint Una Cinnamon 20.3 Kernel: 5.15.x | Quad Core I7 4.2Ghz | 24GB Ram | 1TB NVMe | Intel Graphics
Image
NateMint
Level 1
Level 1
Posts: 4
Joined: Mon Jan 16, 2023 4:31 am
Contact:

Re: Help installing nodejs

Post by NateMint »

The most recent couple times that I installed Node.js on Linux Mint, I used nvm, which is a version manager that lets you easily use different versions of Node as needed. You may want to consider using it and it might help you with the installation. Sometimes I've encountered situations where I want to use an older or newer Node version and nvm helps, a lot.

https://github.com/nvm-sh/nvm
User avatar
coffee412
Level 8
Level 8
Posts: 2264
Joined: Mon Nov 12, 2012 7:38 pm
Location: I dont know
Contact:

Re: Help installing nodejs

Post by coffee412 »

Your package database might have become corrupt. This can happen from a failed install.

Please give this a try:

Code: Select all

sudo dpkg --configure -a
Then I would purge the package from the system:

Code: Select all

sudo apt purge nodejs nodejs-doc
Then try reinstalling.

I have nodejs installed and used npm like suggested.

Hope I helped :)
Ryzen x1800 Asus Prime x370-Pro 32 gigs Ram RX480 graphics
Dell PE T610, Dell PE T710
- List your hardware Profile: inxi -Fxpmrz
MeshCentral * Virtualbox * Debian * InvoiceNinja * NextCloud * Linux since kernel 2.0.36
User avatar
spamegg
Level 14
Level 14
Posts: 5085
Joined: Mon Oct 28, 2019 2:34 am
Contact:

Re: Help installing nodejs

Post by spamegg »

+1 for NVM, it makes all of this SOOO much easier...
kushan-gunasekera
Level 1
Level 1
Posts: 1
Joined: Wed Apr 05, 2023 5:06 pm

Re: Help installing nodejs

Post by kushan-gunasekera »

You can find the answer here and it worked for me :P

https://stackoverflow.com/a/75943902/6194097
Locked

Return to “Programming & Development”