react-router-dom无法在项目文件夹中解析

时间:2018-12-11 02:40:10

标签: reactjs react-router-dom

当我使用react-router-dom尝试构建时,它说无法在我的项目文件夹中解析。

错误消息:

Failed to compile
./node_modules/react-router-dom/es/index.js
Module not found: Can't resolve 'D:\develop\red\node_modules\react-scripts\node_modules\babel-loader\lib\index.js' in 'D:\develop\red'

enter image description here

1 个答案:

答案 0 :(得分:0)

您已经导入了吗?

import ReactDOM from 'react-dom'   
import { BrowserRouter, Route, Switch } from 'react-router-dom'