简体   繁体   English

使用 npx create-react-app 时收到此错误消息

[英]Getting this error messages when using npx create-react-app

error messages when running npx create-react-app运行 npx create-react-app 时出现错误消息

When trying to create a new react app using create-react-app generator I seem to run into a this downloading error.当尝试使用 create-react-app 生成器创建新的反应应用程序时,我似乎遇到了这个下载错误。 Not sure how to fix it.不知道如何修复它。 I've use npx create-react-app many time before but recently it has stopped working.我以前多次使用 npx create-react-app ,但最近它停止工作了。 Any suggestions?有什么建议么?

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

what I normally do is let say I want my project to be called "my-app" I create a folder "my-app" open it in my terminal and then type npx create-react-app./ I'm not sure if this is the best solution but maybe give it a try and see if it works我通常做的就是说我希望我的项目被称为“my-app”我创建一个文件夹“my-app”在我的终端中打开它,然后输入npx create-react-app./我不确定是否这是最好的解决方案,但也许试一试,看看它是否有效

type in the powershell npm install -g create-react-app then type create-react-app todos-list enter image description here输入 powershell npm install -g create-react-app 然后输入 create-react-app todos-list在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM