卡在编辑src/App.js并保存到heroku重新加载



我对React非常陌生,我成功地将我的代码推送到https://react-heroku-juvie.herokuapp.com/的Heroku,但我仍然停留在这里编辑src/App.js并保存以重新加载。我所做的是

npx create-react-app react-heroku
cd react-heroku
npm run build
npm i -g heroku (...login creds)
heroku create react-heroku-juvie
git remote add heroku
git add.
git commit -m "Initial Commit"
git push heroku master

我希望我的应用程序的功能和显示。我该怎么做呢?这是我的src代码https://github.com/juvielone/pocketNote.git

我有同样的问题,但事实上,在本地运行应用程序后,你应该产生一个构建,见https://create-react-app.dev/docs/deployment/

我不知道如何继续使用Heroku,你可以从命令开始:

$ npm run build

我猜这是相当复杂的heroku,所以我建议你尝试与Github页面。

下面是我对github页面所做的:

$ npm install --save gh-pages

(在我的应用程序的主目录中)。

在我的包之后。json文件我添加了3行:1为我的主页(第5行)和2为"预部署";和";deploy"脚本部分中的脚本(第15行和第16行),如下所示(这是我的包的开头)。json文件):

{
"name": "client",
"version": "0.1.0",
"private": true,
"homepage": "https://SebastienBosca.github.io/defi3w",
"dependencies": {
"bootstrap": "^5.1.3",
"react": "^17.0.2",
"react-bootstrap": "^2.2.3",
"react-dom": "^17.0.2",
"react-scripts": "3.2.0",
"web3": "^1.6.1"
},
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build", 
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}, 

之后我跑了

$ npm run deploy

(运行NPM run build和h-pages -d build);我被问到我的用户名(把你的电子邮件或用户名放在github上)和我的密码(在这里,把你的个人访问令牌是强制性的,你的密码将不起作用)。就这些!