【问题标题】:REACT Error: Cannot find module 'core-util-is'反应错误:找不到模块'core-util-is'
【发布时间】:2021-06-15 14:41:33
【问题描述】:

我一直在创建一个 react 应用程序。 我已经尝试过 npx create-react-app 我的应用程序,但它不起作用。现在我得到这个“找不到模块'core-utils-is',以前我用另一个模块修复了另一个问题。所以,我怀疑我有一个错误。 我认为最好的解决方案是从cero开始。但是我不确定如何在不破坏所有(nodejs,npm ...)的情况下卸载我需要的所有重新安装。 我附上我的控制台的图像: enter image description here

$ npx create-react-app my-app internal/modules/cjs/loader.js:883
抛出错误; ^

错误:找不到模块“core-util-is”需要堆栈:

  • C:\Users\ILC\node_modules\hyperquest\node_modules\可读流\lib_stream_duplex.js
  • C:\Users\ILC\node_modules\hyperquest\node_modules\readable-stream\lib_stream_transform.js
  • C:\Users\ILC\node_modules\hyperquest\node_modules\可读流\transform.js
  • C:\Users\ILC\node_modules\hyperquest\node_modules\through2\through2.js
  • C:\Users\ILC\node_modules\hyperquest\index.js
  • C:\Users\ILC\node_modules\create-react-app\createReactApp.js
  • C:\Users\ILC\node_modules\create-react-app\index.js 在 Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15) 在 Function.Module._load (internal/modules/cjs/loader.js:725:27) 在 Module.require (internal/modules/cjs/loader.js:952:19) 在需要(内部/模块/cjs/helpers.js:88:18) 在对象。 (C:\Users\ILC\node_modules\hyperquest\node_modules\可读流\lib_stream_duplex.js:39:12) 在 Module._compile (internal/modules/cjs/loader.js:1063:30) 在 Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) 在 Module.load (internal/modules/cjs/loader.js:928:32) 在 Function.Module._load (internal/modules/cjs/loader.js:769:14) 在 Module.require (internal/modules/cjs/loader.js:952:19) { 代码:'MODULE_NOT_FOUND',requireStack:[ 'C:\Users\ILC\node_modules\hyperquest\node_modules\可读流\lib\_stream_duplex.js', 'C:\Users\ILC\node_modules\hyperquest\node_modules\可读流\lib\_stream_transform.js', 'C:\Users\ILC\node_modules\hyperquest\node_modules\可读流\transform.js', 'C:\Users\ILC\node_modules\hyperquest\node_modules\through2\through2.js', 'C:\Users\ILC\node_modules\hyperquest\index.js', 'C:\Users\ILC\node_modules\create-react-app\createReactApp.js', 'C:\Users\ILC\node_modules\create-react-app\index.js' ] } 谢谢

【问题讨论】:

标签: reactjs create-react-app npx


【解决方案1】:

您可以尝试使用 npm update 更新 npm 并查看是否可以修复它,如果没有,您可以尝试这些步骤。

如果您之前通过npm install -g create-react-app 全局安装了create-react-app,建议您使用npm uninstall -g create-react-appyarn global remove create-react-app 卸载软件包,以确保npx 始终使用最新版本。

您可能还想cd 进入您要托管程序的目录。我倾向于将我所有的程序放入c:\Users\<Username>\Documents\github 的文件夹中。看起来您的 node_modules 正在尝试直接安装到您的用户主目录。

一旦您进入构建应用程序的选择目录并且您已删除全局安装,您可以尝试运行这些命令。
npx create-react-app my-app
cd my-app
npm start

Create React App - Getting Started

编辑:如果这对您有用,那么您可能还想返回 C:\Users\ILC 并删除您的 node_modules 文件夹和任何其他不属于该文件夹的剩余文件,例如 package.json

【讨论】:

  • 谢谢你,特拉维斯。我已经听从了你的建议:我尝试了 npm update,然后我已经 npm uninstall -g create-react-app,我创建了一个新目录并 cd 进入我的新目录和 npx create-react-app my-app,我成为同样的错误。我想我错过了一步。
  • 当然!如果这解决了您的问题,请记住将此解决方案标记为已接受。祝你有美好的一天!
  • 您使用的是 Mac、Windows 还是 Linux?您可能只需要重新安装 npm。
  • 我在 Windows 上。
  • 啊,那么超级简单。 Node.js下载页面
猜你喜欢
  • 1970-01-01
  • 2018-05-17
  • 1970-01-01
  • 2019-09-12
  • 1970-01-01
  • 2017-03-30
  • 1970-01-01
  • 1970-01-01
  • 2021-12-13
相关资源
最近更新 更多