Итак, я создал приложение реагирования, и оно отлично работает с использованием npm start
, поэтому сейчас я пытаюсь развернуть его на сервере.
Я пытаюсь использовать Nginx для развертывания приложения, нопосле его создания я неожиданно получаю сообщение об ошибке, которое не возникает при использовании npm start
.
. Поэтому я настроил Nginx, создал приложение, используя npm run build
, но теперь, когда я захожу на индекс через свои серверы, IP Iполучить следующее
error:
Uncaught TypeError: Cannot read property 'exact' of undefined
at Object.<anonymous> (react-router-dom.js:288)
at f ((index):1)
at Module.951 (Home.js:14)
at f ((index):1)
at Object.434 (profile.svg:1)
at f ((index):1)
at a ((index):1)
at Array.e [as push] ((index):1)
at main.22a79b93.chunk.js:1
Похоже, что-то с моим маршрутизатором реакции, а именно:
import {Redirect, BrowserRouter as Router,Route,Switch} from 'react-router-dom';
<Router>
<CookieConsent buttonText="Accept">
</CookieConsent>
<Switch>
<Route exact path="/" component={Home} />
<Route path="/Register" component={Register} />
<Route path="/Account" component={Account}/>
<Route path="/logout" component={Logout}/>
</Switch>
<Route
path="/dashboard"
render={({ match: { url } }) => (
<Authenticator>
<Dashboard>
<Switch>
<Route path={`${url}/Account`} component={Account} exact />
<Route path={`${url}/Profile`} component={Profile} exact />
<Route path={`${url}/`} component={Account} exact />
<Route component={Page404Dashboard} />
</Switch>
</Dashboard>
</Authenticator>
)}/>
</Router>
Но я не могу найти здесь ничего.
Чтоя скучаю?