Install npm (nodejs) on Ubuntu Linux 20.x (wsl2 on windows11) , then install typescript

Thitipong Samranvarnich
2 min readJul 18, 2022

--

I found how to do from https://www.linuxfordevices.com/tutorials/ubuntu/solved-sudo-npm-command-not-found

Problem I found is :
>> npm: command not found on Ubuntu 20.04LTS?

I tested on kali linux on WSL2 on win11

$ sudo apt install -y nodejs
$ sudo apt install -y npm

Test success or not with

$ node — version
$ npm — version

if not OK then must change path variable in linux by

export > test1.txt

nano test1.txt ===> save to test2.sh only command

export PATH=”….. “ .

>> must remove command like /mnt/c/Program Files/nodejs/npm from path

set permission to path to run

$ chmod +755 ./test2.sh

to remove incorect path run
$ ./test2.sh

Then test again

$ npm — version

I hope now you can use npm now like

$ npm install typescript — save-dev

to install typescript to your ubuntu/kali on wsl2 (on windows 11) .

Note : I setup kali on wsl2 with GUI from this youtube video https://www.youtube.com/watch?v=UXyS-xofGNM

and run with

$ kex — win -s

( I known that , kali is not for Developer but , it’s on my computer and I have no time to install ubuntu now ….. -__-” …. )

Thanks for reading

--

--