1

I am going through a Lynda course, called Learning ReactJS. In the 2nd video of the 3rd chapter, I need to generate a react project. First, I have to perform a global installation of the react app template using the following command on Git Bash (opened with "Run as administrator):

npm install -g create-react-app

However, the specific command is not working. I am getting this error:

$ npm install -g create-react-app
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! enoent request to https://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOENT registry.npmjs.org:443
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\John\AppData\Roaming\npm-cache\_logs\2018-10-09T04_14_56_183Z-debug.log

How can I fix this issue?

I am stuck and can't proceed further to the course without solving this issue. So, I am badly in need of your help.

john
  • 475
  • 2
  • 5
  • 19
  • Take a look at this https://github.com/facebook/create-react-app#creating-an-app – n1stre Oct 09 '18 at 05:53
  • I have seen this command: npm init react-app my-app. The version of npm on my PC is 5.6.0. Should I upgrade it to v 6+? The course is taught with v 5.5.1? Will I face any problem with the course if I update npm to the latest version? Please, advise from a beginner perspective. – john Oct 09 '18 at 06:06
  • 1
    Simply use `npx create-react-app my-app`. It is more probably that you'll face more problems with `react` itself rather then `npm`. But I would suggest you to use latest versions of everything. You'll learn a lot after resolving the versioning issues that will occur – n1stre Oct 09 '18 at 06:15
  • If `create-react-app` is not installed successfully, you will not be able to create a new project. Take a look at this similar issue https://stackoverflow.com/questions/39592908/error-getaddrinfo-enotfound-registry-npmjs-org-registry-npmjs-org443() and make sure you can connect to npm properly. – Franklin Farahani Oct 09 '18 at 06:18
  • use **sudo** method `sudo npm i -g create-react-app` should work – Ajay Kumar Oct 09 '18 at 07:08
  • @streletss npx create-react-app my-app solved the issue. However, I have managed to run "npm install -g create-react-app" successfully. I closed and restarted the Git Bash several times. Each time, I typed the specific command. After repeating the process several times, it works! Not sure what had happened though. And thanks for your suggestion regarding using the latest version. As I am a beginner, I will go with the one shown in the course. After finishing it, I will experiment with the latest version. – john Oct 09 '18 at 08:29

1 Answers1

0

There is supposed to be another param in the line

npx create-react-app <folderName>

This will create an app with basic wireframe in the "folderName". Now you can work on this as a separate independent project.

Vishesh
  • 167
  • 2
  • 11