代码之家  ›  专栏  ›  技术社区  ›  Ryuujo dhara gosai

为什么我在创建React应用程序时出错?

  •  0
  • Ryuujo dhara gosai  · 技术社区  · 6 年前

    我是新来的,想学习ReactJS,我开始安装一个新的空文件夹 npx create-react-app . 命令。我有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
    
    2 回复  |  直到 6 年前
        1
  •  1
  •   Bon Andre Opina    6 年前

    你试过以管理员身份运行这个吗?

        2
  •  0
  •   Raju Choudhary    6 年前

    在命令中添加这样的项目名称:

     npx create-react-app your-project-name