【问题标题】:How to Solve Uncaught Error: Module build failed (from ./node_modules/babel-loader/lib/index.js):如何解决未捕获的错误:模块构建失败(来自 ./node_modules/babel-loader/lib/index.js):
【发布时间】:2022-01-03 19:22:35
【问题描述】:

我运行 npm install 但这个错误无法解决如何解决这个错误?错误代码如下:

未捕获的错误:模块构建失败(来自 ./node_modules/babel-loader/lib/index.js): SyntaxError: G:\projects\dubole project\Sky-Stars-Client-Side\src\App.js: Unexpected token (20:1)

[0m [90m 18 |[39m [36mimport[39m [33mServiceDetails[39m [36mfrom[39m [32m'./Pages/ServiceDetails/ServiceDetails'[39m[33m;[39m[0m [0m [90m 19 |[39m [36mimport[39m [33mDefaultDashboard[39m [36mfrom[39m [32m'./Pages/Dashboard/DefaultDashboard'[39m[33m;[39m[0m [0m[31m[1m>[22m[39m[90m 20|[39m[33mwebpack_require (http://localhost:3000/static/js/bundle.js:48093:33) 在 fn (http://localhost:3000/static/js/bundle.js:48314:21) 在模块../src/index.js (http://localhost:3000/static/js/bundle.js:322:62) 在 Module.options.factory (http://localhost:3000/static/js/bundle.js:48643:31) 在 webpack_require (http://localhost:3000/static/js/bundle.js:48093:33) 在 http://localhost:3000/static/js/bundle.js:49282:37 在 http://localhost:3000/static/js/bundle.js:49284:12 ./src/App.js@bundle.js:10 options.factory @反应刷新:6 webpack_require @bootstrap:24 fn@热模块更换:61 ./src/index.js@store.js:12 options.factory @反应刷新:6 webpack_require @bootstrap:24 (匿名)@启动:7 (匿名)@启动:7

【问题讨论】:

  • 你是否从这里在你的电脑上安装了 node.js:nodejs.org/en

标签: javascript node.js reactjs


【解决方案1】:
npm install @babel/core @babel/preset-env

尝试再次安装 babel 并更新您的 Babel 配置

"presets": [
  "@babel/preset-env"
]

【讨论】:

  • 非常感谢。现在我的代码正在运行。
  • @FarzanaPomy 亲爱的,请按勾号作为正确答案。
猜你喜欢
  • 1970-01-01
  • 2019-08-22
  • 2021-04-17
  • 2021-03-20
  • 2019-08-01
  • 1970-01-01
  • 2021-11-26
  • 1970-01-01
  • 2023-03-28
相关资源
最近更新 更多