0

I was trying to install react . I found there are two ways of doing it either through npm or through yarn . I am using Ubuntu 18.04 . I have installed node and npm .

name@admin-desktop:~$ node -v
v16.14.0
name@admin-desktop:~$ npm -v
8.3.1

After that I have installed yarn via npm through following commands :

npm install --global yarn
name@admin-desktop:~$ yarn --version
1.22.19

after that I gave following command :

yarn global add create-react-app@1.5.2

it gave following output:

yarn global v1.22.19
[1/4] Resolving packages...
warning create-react-app > tar-pack > tar@2.2.2: This 
version of tar is no longer supported, and will not 
receive security updates. Please upgrade asap.
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Installed "create-react-app@1.5.2" with binaries:
      - create-react-app
Done in 3.53s.

then I gave following command :

name@admin-desktop:~$ create-react-app --help
create-react-app: command not found

May I know why this is creating a problem when it successfully installed ?

I also tried to install react through npm but it again created problem so I tried to seek help from this post when sudo npm install -g was not working so I gave command which npm and it resulted in /home/name/.nvm/versions/node/v16.14.0/bin/npm

after that I gave command :

sudo ln -s /home/name/.nvm/versions/node/v16.14.0/bin/npm 
/usr/bin/npm

After that I again tried to install react but again got error :

sudo npm install -g create-react-app@1.5.2
/usr/bin/env: ‘node’: No such file or directory

How to resolve these issues?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Shashi
  • 700
  • 1
  • 7
  • 15

1 Answers1

1

just do the following steps and the problem is solved:

npm uninstall -g create-react-app

npx create-react-app@latest my-app-name

you don't need to install create-react-app globaly anymore