[英]Error: Cannot find module 'react-dev-utils/inquirer'
when I run this command in my project:当我在我的项目中运行这个命令时:
yarn eject
shows this eror:显示此错误:
[root@VM-0-16-centos cruise-web]# yarn eject
yarn run v1.22.10
$ react-scripts eject
internal/modules/cjs/loader.js:834
throw err;
^
Error: Cannot find module 'react-dev-utils/inquirer'
Require stack:
- /home/dolphin/sync/source/cruise-web/node_modules/react-scripts/scripts/eject.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/dolphin/sync/source/cruise-web/node_modules/react-scripts/scripts/eject.js:23:18)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/dolphin/sync/source/cruise-web/node_modules/react-scripts/scripts/eject.js'
]
}
then I add a dependency in my package.json
:然后我在我的
package.json
添加一个依赖项:
"react-dev-utils":"11.0.1"
then run the command to install and rerun eject:然后运行命令安装并重新运行弹出:
yarn
yarn eject
but the problem still not fixed, what should I do to make it work?但问题仍未解决,我该怎么做才能使其正常工作?
I just had the same problem.我只是遇到了同样的问题。 Check out
react-scripts
version on package.json
.在
package.json
上查看react-scripts
版本。 I guessed that this ( https://github.com/facebook/create-react-app/pull/10083 ) would be a reason why yarn eject
throw err.我猜这( https://github.com/facebook/create-react-app/pull/10083 )将是
yarn eject
抛出错误的原因。
I was able to solve the problem by installing the last version of react-script:我能够通过安装最新版本的 react-script 来解决这个问题:
npm install react-scripts@4.0.1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.