【发布时间】:2021-09-27 18:47:05
【问题描述】:
我在部署 typescript react 应用程序时遇到问题,我得到的只是 MainTemplate.tsx 文件中最外层的元素,我应该会看到一个日志记录屏幕,我在本地没有可用的路由。另外,我现在已经做了很多次 npm run build ,并且说我上次部署是 14 小时前,我该如何刷新它?我试图将我的 deply 脚本更改为这个,但没有奏效:
“部署”:“./node_modules/gh-pages/bin/gh-pages-clean.js && gh-pages -d build”
这是我的 package.json
{
"homepage": "https://dziekonskik.github.io/project-money-front",
"name": "project-money-front",
"version": "0.1.0",
"private": false,
"proxy": "http://localhost:3000",
"dependencies": {
"@aws-amplify/ui-react": "^1.2.3",
"@reduxjs/toolkit": "^1.5.1",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"@types/jest": "^24.9.1",
"@types/node": "^12.20.14",
"@types/react": "^16.14.8",
"@types/react-dom": "^16.9.13",
"@types/react-redux": "^7.1.16",
"@types/styled-components": "^5.1.9",
"aws-amplify": "^4.1.1",
"axios": "^0.21.1",
"dotenv": "^8.2.0",
"formik": "^2.2.9",
"gsap": "^3.7.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"styled-components": "^5.3.0",
"styled-reset": "^4.3.4",
"typescript": "~4.1.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "./node_modules/gh-pages/bin/gh-pages-clean.js && gh-pages -d build"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/react-router-dom": "^5.1.7",
"gh-pages": "^3.2.3"
}
}
谢谢!
【问题讨论】:
-
很抱歉不是 npm run build 而是 deploy,实际上我都做了很多次
-
你检查这个部分是 cra doc:create-react-app.dev/docs/… 吗?
标签: reactjs typescript create-react-app github-pages