Error: EPERM: operation not permitted, mkdir ‘D:\nodejs\node_modules\npm\node_cache\_npx‘

Question:

  implement   NPX create react app XXX reports an error

PS D:\Desktop>npx create-react-app demo
Error: EPERM: operation not permitted, mkdir 'D:\nodejs\node_modules\npm\node_cache\_npx'
TypeError: Cannot read property 'get' of undefined
    at errorHandler (D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\utils\error-handler.js:213:18)
    at D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\bin\npm-cli.js:83:20
    at cb (D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\npm.js:215:22)
    at D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\npm.js:253:24
    at D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\config\core.js:81:7
    at Array.forEach (<anonymous>)
    at D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\config\core.js:80:13
    at f (D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\node_modules\once\once.js:25:25)
    at afterExtras (D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\config\core.js:178:20)
    at D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\node_modules\mkdirp\index.js:35:29
D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\utils\error-handler.js:213
  if (npm.config.get('json')) {
                 ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (D:\nodejs\node_modules\npm\node_global\node_modules\npx\node_modules\npm\lib\utils\error-handler.js:213:18)
    at process.emit (events.js:400:28)
    at process._fatalException (internal/process/execution.js:167:25)
Install for [ 'create-react-app@latest' ] failed with code 7

terms of settlement:

Create react- app@latest Install to global

npm install create-react-app@latest -g

Run after installation

 npx create-react-app demo

So you can write the project

Read More: