#Nodejs installation problem

83 messages · Page 1 of 1 (latest)

vale reef
#

I can't compile JS code because of this problem. I would be glad to take some advice.

wheat gull
#

You don't have node js or the nvm things are not in ~/.bashrc PATH

#

If you don't have node js install this

installs nvm (Node Version Manager)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

download and install Node.js (you may need to restart the terminal)

nvm install 20

Or if you arleady install node js type this in ~/.bashrc file and then source ~/.bashrc

nvm

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion

vale reef
wheat gull
#

type source ~/.bashrc

vale reef
#

Nothing happened, brother.

wheat gull
#

if you install with nvm it should be added automatically in ~/.bashrc

#

open the bashrc code ~/.bashrc

paste in here i wanna see

vale reef
#

Screenshots you mean?

wheat gull
#

Yeah you can screenshot

#

Should be like this, pay attention in nvm code.

vale reef
wheat gull
#

Can i see in 100 line?

#

like mine

vale reef
wheat gull
#

Hmmm weird stuff, wait.

vale reef
#

I can send more screenshots if you need.

wheat gull
#

type node --version

vale reef
wheat gull
#

type node 01.1.js

vale reef
#

I wrote this to test

wheat gull
#

What do you mean

#

node is working perfectly fine

vale reef
#

the file 01.1.js

vale reef
#

First screenshot from the post is the output, not the terminal.

wheat gull
#

wait

vale reef
#

its okay

wheat gull
#

i use code runner extension, perfectly fine.

[Running] node "/home/fauzan/lol/01.js"
Hello world
[Done] exited with code=0 in 0.054 seconds

vale reef
#

I think the problem is in the $PATH of node but don't know what...

wheat gull
#

try adding this
export PATH="/home/mirko/.nvm/versions/node/v20.12.2/bin:$PATH"

#

below the nvm

vale reef
wheat gull
#

type in ~/.bashrc file

vale reef
#

oh sorry

vale reef
wheat gull
#

yap

vale reef
#

Well, ctrl+alt+n still gives the same error message

wheat gull
#

change the 20.12.2 to 20.14.0 and then source ~/.bashrc

#

In your machine node works perfectly fine but in vscode weird stuff happen

vale reef
#

:/

#

oops, accidentally made it 20.14.4

#

but at 20.14.0 is the same

wheat gull
#

Remove the EXPORT path from bashrc

vale reef
#

no difference

vale reef
wheat gull
#

Yap here
export PATH="/home/mirko/.nvm/versions/node/v20.12.2/bin:$PATH"

vale reef
#

okay, I did

wheat gull
#

And then restart

vale reef
#

restart PC or VSCode?

wheat gull
#

pc

#

come back again

vale reef
wheat gull
#

-_- weird stuff, i mean if you type node 01.1.js you can, but if you run it with vscode it's error.

vale reef
wheat gull
#

Yeah you can try this

  1. Reinstall node
  2. Reinstall vscode

And then sudo apt update && apt upgrade

vale reef
#

How to uninstall node? Whats the command?

wheat gull
#

Where did you install node?

vale reef
#

from the terminal

wheat gull
#

I mean nvm or apt or homebrew

vale reef
#

nvm i think

#

yeah, nvm for sure

wheat gull
vale reef
#

is this how it should be?

wheat gull
#

nvm deactivate
nvm uninstall 20.14.0

vale reef
#

oh thank you that worked

wheat gull
vale reef
#

After I uninstalled nvm and node I still see the version if i type nvm -v or node -v, is this normal?

wheat gull
#

yeah normal

#

Nvm is node.js version manager in short, is like rbenv from ruby land

#

I mean weird stuff happen again, why you have 2 node version -_-, but the nvm thing is normal.

vale reef
#

Thank you so much, brother!

wheat gull
#

Oh my god

vale reef
#

Any idea how I can get Java running on VSCode? Haven't done any research on my own yet.

wheat gull
#

I never install java in my system

#

maybe you surfing on the internet or ask in java land

#

i mean java forum stuff like that

vale reef
#

Okay, brother, god bless you!

wheat gull
#

Yeah good luck on your journey 🙂