1

When I run create react-app in terminal it display some errors.

npx create react-app sample

Error: EPERM: operation not permitted, mkdir 'C:\Users\Yasiru'
TypeError: Cannot read property 'loaded' of undefined
    at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
    at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
    at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:77:20
    at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:225:22)
    at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:263:24
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:83:7
    at Array.forEach (<anonymous>)
    at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:82:13
    at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25)
    at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:173:20)
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98
  var doExit = npm.config.loaded ? npm.config.get('_exit') : true
                          ^

TypeError: Cannot read property 'loaded' of undefined
    at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:98:27)
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3)
    at process.emit (events.js:196:13)
    at process._fatalException (internal/process/execution.js:142:25)
Install for [ 'create@latest' ] failed with code 7
Ghonima
  • 2,978
  • 2
  • 14
  • 23
yasiru
  • 15
  • 1
  • 5
  • 1
    This is apparently an inherent problem with npm, npx. If your computer account username has a space ' ' in it, the command will not work. I am facing the same issue and I haven't find a solution yet. – AG_HIHI Dec 29 '19 at 14:36

4 Answers4

0

When you install create-react-app globally, you do not need to run the command with npm/npx/yarn. It is its own binary, so all you should have to type is "create-react-app directory" where 'directory' is the directory you want to create the react app within.

Also, it looks like the command you're running is "create react-app" rather than "create-react-app", make sure you do not miss the first dash or you will not be running the correct command.

0

delete node.js and download from node.js LTS and when you install in you computer click all the approval boxes and check the version of npm>5 and node.js and your internet ,good luck;)

Redouane
  • 1
  • 1
0

Open Windows PowerShell(Admin) then paste this and make sure to change name from Aamir~Naved to your name and similary if your name has more than one word,kindly add a tilde(~) in between:

npm config set cache "C:\\Users\\Aamir~Naved\\AppData\\Roaming\\npm-cache" --global

then paste this:(make sure to edit directory_name with name of the directory you want to create react app in. for example: C:\learnreact

npx create-react-app directory_name
Aamir Naved
  • 111
  • 1
  • 3
0

I just went through this and found that all I had to do was to give write permission to the folder in which I wanted to create the app. Hope it's that simple for you.

WarrenH
  • 1
  • 1