我正在尝试将域名添加到我的react应用程序中,但是添加时收到404响应。它在托管github页面的工作正常,但是当我添加域时出现错误。不知道我的package.json文件中是否缺少某些内容? 请帮助,我已经被困了很长时间了。
这是我的package.json
{
"name": "casahogar",
"homepage": "https://castillojuan1000.github.com/casaHogar",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.20.0",
"cors": "^2.8.5",
"emailjs-com": "^2.6.3",
"express": "^4.17.1",
"feather-icons": "^4.28.0",
"framer-motion": "^1.11.1",
"gh-pages": "^3.1.0",
"react": "^16.13.1",
"react-axios": "^2.0.3",
"react-dom": "^16.13.1",
"react-modal": "^3.11.2",
"react-router-dom": "^5.2.0",
"react-scripts": "^3.4.3",
"react-scroll": "^1.8.1",
"react-slick": "^0.26.1",
"react-stripe-checkout": "^2.6.3",
"react-toastify": "^6.0.9",
"slick-carousel": "^1.8.1",
"smoothscroll-polyfill": "^0.4.4",
"stripe": "^8.108.0",
"styled-components": "^5.1.1",
"tailwindcss": "^1.4.6",
"twin.macro": "^1.4.1",
"use-in-view": "^1.0.15",
"uuid": "^8.3.1",
"uuidv4": "^6.2.4"
},
"proxy": "http://localhost:4242",
"scripts": {
"server": "nodemon src/Server.js",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "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": {
"nodemon": "^2.0.4"
}
}
答案 0 :(得分:1)
您的网站正试图从错误的网址中获取静态资产(JS和CSS)。它在https://www.casahogarscj.com/casaHogar/static/...
上请求他们,而Github在https://www.casahogarscj.com/static/...
上为他们服务(没有casaHogar)。
要解决此问题,您需要在homepage
中将https://www.casahogarscj.com/
的值更改为package.json
,然后重建网站。