【问题标题】:Getting this error messages when using npx create-react-app使用 npx create-react-app 时收到此错误消息
【发布时间】:2021-06-04 17:14:12
【问题描述】:

error messages when running npx create-react-app

当尝试使用 create-react-app 生成器创建新的 react 应用程序时,我似乎遇到了这个下载错误。不知道如何解决它。我以前多次使用 npx create-react-app ,但最近它已经停止工作。有什么建议吗?

Andrewcarey@Andrews-MacBook-Air Strangers_Things % npx create-react-app my-app
internal/modules/cjs/loader.js:311
      throw err;
      ^

Error: Cannot find module '/Users/andrewcarey/.npm/_npx/c67e74de0542c87c/node_modules/brace-expansion/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:303:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:516:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/andrewcarey/.npm/_npx/c67e74de0542c87c/node_modules/minimatch/minimatch.js:10:14)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32) {
  code: 'MODULE_NOT_FOUND',
  path: '/Users/andrewcarey/.npm/_npx/c67e74de0542c87c/node_modules/brace-expansion/package.json',
  requestPath: 'brace-expansion'
}
npm ERR! code 1
npm ERR! path /Users/andrewcarey/Desktop/Strangers_Things
npm ERR! command failed
npm ERR! command sh -c create-react-app "my-app"

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/andrewcarey/.npm/_logs/2021-06-01T00_36_33_693Z-debug.log

【问题讨论】:

  • 你机器上的 node 和 npm 版本是什么?您需要在您的机器上安装 Node >= 10.16 和 npm >= 5.6。

标签: node.js reactjs npm npx


【解决方案1】:

我通常会说我希望我的项目被称为“my-app”我创建一个文件夹“my-app”在我的终端中打开它然后输入npx create-react-app ./我不确定这是不是最好的解决方案,但不妨试一试,看看它是否有效

【讨论】:

    【解决方案2】:

    在 powershell 中输入 npm install -g create-react-app 然后输入 create-react-app todos-listenter image description here

    【讨论】:

      猜你喜欢
      • 2022-07-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-05
      • 2021-04-24
      • 2021-03-03
      • 1970-01-01
      • 2020-07-24
      • 1970-01-01
      相关资源
      最近更新 更多