github 页面 + namecheap 域 = 响应状态 404
github pages + namecheap domain = response status 404
我正在尝试将域名添加到我的 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"
}
}
这是我在 namecheap 中的设置:
您的网站正在尝试从错误的 URL 获取静态资源(JS 和 CSS)。它在 https://www.casahogarscj.com/casaHogar/static/...
请求它们,而 Github 在 https://www.casahogarscj.com/static/...
为它们提供服务(没有 casaHogar)。
要解决此问题,您需要将 package.json
中的 homepage
值更改为 https://www.casahogarscj.com/
并重建您的网站。
我正在尝试将域名添加到我的 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"
}
}
这是我在 namecheap 中的设置:
您的网站正在尝试从错误的 URL 获取静态资源(JS 和 CSS)。它在 https://www.casahogarscj.com/casaHogar/static/...
请求它们,而 Github 在 https://www.casahogarscj.com/static/...
为它们提供服务(没有 casaHogar)。
要解决此问题,您需要将 package.json
中的 homepage
值更改为 https://www.casahogarscj.com/
并重建您的网站。