npx webpack报错
npx webpack报错:
ERROR in ./src/index.js Module build failed (from ./node_modules/babel-loader/lib/index.j相关截图:s): Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel. (While processing preset: "C:\\Users\\35127\\Nutstore\\1\\study\\study\\Mooc\\login_api\\node_modules\\@babel\\preset-env\\lib\\index.js") at throwVersionError (C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\@babel\helper-plugin-utils\lib\index.js:67:11) at Object.assertVersion (C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\@babel\helper-plugin-utils\lib\index.js:10:5) at C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\@babel\preset-env\lib\index.js:201:7 at C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\@babel\helper-plugin-utils\lib\index.js:31:12 at C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\babel-core\lib\transformation\file\options\option-manager.js:317:46 at Array.map (<anonymous>) at OptionManager.resolvePresets (C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20) at OptionManager.mergePresets (C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10) at OptionManager.mergeOptions (C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14) at OptionManager.init (C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12) at File.initOptions (C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\babel-core\lib\transformation\file\index.js:212:65) at new File (C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\babel-core\lib\transformation\file\index.js:135:24) at Pipeline.transform (C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\babel-core\lib\transformation\pipeline.js:46:16) at transpile (C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\babel-loader\lib\index.js:50:20) at Object.module.exports (C:\Users\35127\Nutstore\1\study\study\Mooc\login_api\node_modules\babel-loader\lib\index.js:173:20) npm ERR! code 2 npm ERR! path C:\Users\35127\Nutstore\1\study\study\Mooc\login_api npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c webpack npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\35127\AppData\Local\npm-cache\_logs\2023-03-31T07_34_00_774Z-debug.log
29
收起
正在回答 回答被采纳积分+1
1回答
Brian
2023-03-31 18:44:39
Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core
你看看欠的babel的版本是不是比较旧,两种解决办法:
1. webpack降版本,npm i -D webpack@4 webpack-cli@3
2. 升级babel版本 npm i -D @babel/core 最新的版本https://www.npmjs.com/package/@babel/core
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星