Reactjs react创建应用程序heroku未运行应用程序
我用这个创建了一个react应用程序 我还向其中添加了react router,因此我的index.js现在如下所示:Reactjs react创建应用程序heroku未运行应用程序,reactjs,heroku,create-react-app,Reactjs,Heroku,Create React App,我用这个创建了一个react应用程序 我还向其中添加了react router,因此我的index.js现在如下所示: import React from 'react'; import ReactDOM from 'react-dom'; import Home from './views/Home'; import CreateRestaurant from './views/CreateRestaurant'; import registerServiceWorker from './re
import React from 'react';
import ReactDOM from 'react-dom';
import Home from './views/Home';
import CreateRestaurant from './views/CreateRestaurant';
import registerServiceWorker from './registerServiceWorker';
import {
BrowserRouter as Router,
Route
} from 'react-router-dom';
ReactDOM.render(
<Router>
<div>
<Route exact path="/" component={ Home }/>
<Route path="/createRestaurant" component={ CreateRestaurant }/>
</div>
</Router>,
document.getElementById('root')
);
registerServiceWorker();
我获得了成功的构建,但当我通过heroku URL打开应用程序时
我仍然看到标准页面上写着:
欢迎反应
要开始,请编辑src/App.js并保存以重新加载
如何让heroku显示我的应用程序?在部署到heroku之前,您必须构建react应用程序 有一种工具可以自动执行此过程 所需步骤如下
heroku create $APP_NAME --buildpack https://github.com/mars/create-
react-app-buildpack.git
git add .
git commit -m "Start with create-react-app"
git push heroku master
heroku open
在部署到heroku之前,您必须构建react应用程序 有一种工具可以自动执行此过程 所需步骤如下
heroku create $APP_NAME --buildpack https://github.com/mars/create-
react-app-buildpack.git
git add .
git commit -m "Start with create-react-app"
git push heroku master
heroku open
在将应用程序部署到heroku之前,您是否构建了应用程序?实际上,没有,因为该构建似乎是在将应用程序推送到heroku Master时创建的。您不需要在部署之前创建构建。您的网页包配置可能有问题。尝试在本地构建它,并为客户服务build@Swapnil我在哪里可以找到此构建包的网页包配置?它似乎不在我的目录中。在部署到heroku之前,你是否构建了你的应用程序?事实上,没有,因为它似乎是在将应用程序推送到heroku Master时创建的。在部署之前,你不需要创建一个构建。您的网页包配置可能有问题。尝试在本地构建它,并为客户服务build@Swapnil我在哪里可以找到此构建包的网页包配置?它似乎不在我的目录中这是我使用的构建包。然而,当我推到heroku Master时,我仍然得到了标准页面,这很有帮助!我不得不做一个git add。这是我使用的构建包。然而,当我推到heroku Master时,我仍然得到了标准页面,这很有帮助!我不得不做一个git add。