javascript - 将 webpack 与 React 一起使用时,如何修复运行时错误?
问题描述
如果我的 webpack 无法在终端中编译文件,我该如何开始调试这个问题?
这是终端中的错误:
ERROR in ./app/components/App.js
Module not found: Error: Can't resolve 'react-router-dom' in '/Users/andrewtalle/Desktop/github-battle/app/components'
@ ./app/components/App.js 21:18-45
@ ./app/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./app/index.js
ERROR in ./app/components/Home.js
Module not found: Error: Can't resolve 'react-router-dom' in '/Users/andrewtalle/Desktop/github-battle/app/components'
@ ./app/components/Home.js 21:11-38
@ ./app/components/App.js
@ ./app/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./app/index.js
ERROR in ./app/components/Nav.js
Module not found: Error: Can't resolve 'react-router-dom' in '/Users/andrewtalle/Desktop/github-battle/app/components'
@ ./app/components/Nav.js 3:14-41
@ ./app/components/App.js
@ ./app/index.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./app/index.js
Child html-webpack-plugin for "index.html":
1 asset
Entrypoint undefined = index.html
[./node_modules/html-webpack-plugin/lib/loader.js!./app/index.html] 324 bytes {0} [built]
[./node_modules/lodash/lodash.js] 527 KiB {0} [built]
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 492 bytes {0} [built]
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 546 bytes {0} [built]
ℹ 「wdm」: Failed to compile.
解决方案
推荐阅读
- c# - 试图防止多次快速按下按钮,但按钮没有正确禁用
- javascript - 在父视图中触发子视图模型方法:MarionetteJs
- php - dialogflow 使用 php 客户端库更新意图训练短语
- python - 散景图未显示在 chrome 上
- arrays - 在 matlab 中有效地矢量化逐元素操作
- android - AutoCompleteTextView 函数 afterTextChanged 每次调用
- python - 将字节对象转换为 python 字典或 json 对象
- javascript - 删除一行后刷新 Boostrap-Vue 表
- android - 0 处的值无法转换为 JSON 对象
- delphi-2010 - 如何修复 E2033 实际和形式 var 参数的类型在 Delphi 上必须相同?