小编典典

为什么在创建React App时出现错误?

reactjs

我是新手,想学习ReactJS,所以我开始使用npx create-react-app .command 安装一个新的空文件夹。我有npm
v.6.4.1。当我尝试执行命令时,它给了我一个错误。

Error: EPERM: operation not permitted, mkdir 'C:\Users\LOGIVAR'
TypeError: Cannot read property 'get' of undefined
    at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:78:20
    at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:228:22)
    at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:266: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)
    at C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:47:53
C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205
  if (npm.config.get('json')) {
                 ^

TypeError: Cannot read property 'get' of undefined
    at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:205:18)
    at process.emit (events.js:182:13)
    at process._fatalException (internal/bootstrap/node.js:485:27)
Install for create-react-app@latest failed with code 7

我已经在Laravel空项目上执行了相同的命令,但是仍然给了我同样的错误。

您能告诉我主要的原因是什么以及如何解决这个问题?

编辑: 我已经以管理员身份运行终端,但是我收到另一个错误:

npm ERR! code ENOLOCAL
npm ERR! Could not install from "2\AppData\Roaming\npm-cache\_npx\10552" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\LOGIVAR TY 2\AppData\Roaming\npm-cache\_logs\2019-01-23T04_18_56_036Z-debug.log
Install for create-react-app@latest failed with code 1

阅读 203

收藏
2020-07-22

共1个答案

小编典典

您是否尝试过以管理员身份运行它?

2020-07-22