Reactjs 使用npm run deploy将现有git repo发布到github页面时出现问题
我正在尝试使用Reactjs 使用npm run deploy将现有git repo发布到github页面时出现问题,reactjs,git,github,github-pages,Reactjs,Git,Github,Github Pages,我正在尝试使用gh页面模块在GitHub页面上发布一个网站 这是我的包。json: { "name": "rahmanstatic_website", "version": "0.1.0", "private": true, "homepage": "https://rahmanharoon.github.io/Rahman-Protfolio&quo
gh页面
模块在GitHub页面上发布一个网站
这是我的包。json:
{
"name": "rahmanstatic_website",
"version": "0.1.0",
"private": true,
"homepage": "https://rahmanharoon.github.io/Rahman-Protfolio",
"dependencies": {
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.2.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-icons": "^4.1.0",
"react-router-dom": "^5.2.0",
"react-router-hash-link": "^2.3.1",
"react-scripts": "4.0.1",
"react-scroll": "^1.8.1",
"styled-components": "^5.2.1",
"web-vitals": "^0.2.4"
},
"scripts": {
"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",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"gh-pages": "^3.1.0"
}
}
我已经将代码推送到GitHub分支。因此,当它开始部署时,我调用了npm run build,我得到了一个错误,我在网上搜索,但没有得到正确的结果。这里是错误
我检查了我的环境变量,它的路径是C:\Windows\System32(我认为环境变量没有问题)
这是.gitignore:
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
任何建议都将有助于回购协议的设置。您需要选择正确的路径吗 并确保您的回购包含您的构建 可能需要从
.gitignore
您好,如果运行
git remote-v
,您是否可以确认收到您的回购URL?在Github上,您配置了Github页面来跟踪您的主分支?是的,我配置了Github页面,但我运行了git remote-v
它显示的git'未被识别为内部或外部命令,
因此,即使您检查了它,我认为env vars也存在问题。不要在windows提示符下运行命令,而是尝试使用Git bash运行它这里是我使用Git bash发布后获得的链接我可以在运行Git remote-v时获得Git repo URl使用Git bash@jean Smaugya我的路径是正确的。。我添加了gitignore文件内容,请检查是否从.gitignore中删除/build
。运行npm运行构建
或warn构建
并提交构建文件夹;)我认为这是一个创建反应应用程序这是发布后的链接。readme.md内容显示在该页面上