简体   繁体   English

“npm start”错误:在 ReactJS 中找不到模块“babel-code-frame”

[英]'npm start' error: Cannot find module 'babel-code-frame' in ReactJS

When I try to give 'npm start' in the frontend of my aplication, the shell gives a giant error.当我尝试在应用程序的前端给出“npm start”时,shell 给出了一个巨大的错误。 My package.json dont have any error of script, and I excluded the 'node_modules' and gived 'npm install' a lot of times.我的 package.json 没有任何脚本错误,我排除了“node_modules”并多次给出“npm install”。 And error persists.并且错误仍然存​​在。

I've been researching about this since yesterday, and nothing.从昨天开始我一直在研究这个,什么也没有。

The error:错误:

internal/modules/cjs/loader.js:985
  throw err;
  ^

Error: Cannot find module 'babel-code-frame'
Require stack:
- C:\Users\Helton\Documents\www\omnistack_bth\be-the-hero\frontend\node_modules\fork-ts-checker-webpack-plugin\lib\forma
tter\codeframeFormatter.js
- C:\Users\Helton\Documents\www\omnistack_bth\be-the-hero\frontend\node_modules\fork-ts-checker-webpack-plugin\lib\index
.js
- C:\Users\Helton\Documents\www\omnistack_bth\be-the-hero\frontend\node_modules\react-dev-utils\ForkTsCheckerWebpackPlug
in.js
- C:\Users\Helton\Documents\www\omnistack_bth\be-the-hero\frontend\node_modules\react-dev-utils\WebpackDevServerUtils.js
- C:\Users\Helton\Documents\www\omnistack_bth\be-the-hero\frontend\node_modules\react-scripts\scripts\start.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\Users\Helton\Documents\www\omnistack_bth\be-the-hero\frontend\node_modules\fork-ts-checker
-webpack-plugin\lib\formatter\codeframeFormatter.js:4:19)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Helton\\Documents\\www\\omnistack_bth\\be-the-hero\\frontend\\node_modules\\fork-ts-checker-webpack-plug
in\\lib\\formatter\\codeframeFormatter.js',
    'C:\\Users\\Helton\\Documents\\www\\omnistack_bth\\be-the-hero\\frontend\\node_modules\\fork-ts-checker-webpack-plug
in\\lib\\index.js',
    'C:\\Users\\Helton\\Documents\\www\\omnistack_bth\\be-the-hero\\frontend\\node_modules\\react-dev-utils\\ForkTsCheck
erWebpackPlugin.js',
    'C:\\Users\\Helton\\Documents\\www\\omnistack_bth\\be-the-hero\\frontend\\node_modules\\react-dev-utils\\WebpackDevS
erverUtils.js',
    'C:\\Users\\Helton\\Documents\\www\\omnistack_bth\\be-the-hero\\frontend\\node_modules\\react-scripts\\scripts\\star
t.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Helton\AppData\Roaming\npm-cache\_logs\2020-03-27T11_21_24_592Z-debug.log

I need, and want to solve that.我需要,并且想解决这个问题。 If can you help me I would stay very happy.如果你能帮助我,我会很开心。

Thanks!谢谢!

Actually, this error appears when "babel-code-frame" module is missing from the project实际上,当项目中缺少“babel-code-frame”模块时会出现此错误

write this command in terminal:在终端中写这个命令:

npm install --save-dev @babel/code-frame

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

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