'Yarn shows command not found

I'm using Yarn or NPM to install most Node programs, but when I try to install Angular CLI using Yarn, it shows "command not found" (I'm using Indonesian language as my OS language):

leapofazzam@localhost:~$ yarn global add @angular/cli
Perintah 'yarn' tidak ditemukan, tapi dapat dipasang dengan:

apt install cmdtest

leapofazzam@localhost:~$ su
Sandi:
root@localhost:~# yarn global add @angular/cli

Perintah 'yarn' tidak ditemukan, tapi dapat dipasang dengan:

apt install cmdtest

root@localhost:~# su root
root@localhost:~# yarn global add @angular/cli

Perintah 'yarn' tidak ditemukan, tapi dapat dipasang dengan:

apt install cmdtest

root@localhost:~#

Even as root, the message still showing.



Solution 1:[1]

A few questions

is npm/node installed? if not (it looks like you are using apt package manager)

apt-get install nodejs

if permissions denied error sudo apt-get install nodejs

is yarn installed? if not

npm install -g yarn

If permissions denied error try

sudo npm install -g yarn

That should do it

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Software Person