Node.js “无法完成”;“npm运行部署”;用于在Github页面上使用的React命令
我正在尝试在Github页面上部署一个网站,该项目是使用Node.js “无法完成”;“npm运行部署”;用于在Github页面上使用的React命令,node.js,reactjs,git,npm,github-pages,Node.js,Reactjs,Git,Npm,Github Pages,我正在尝试在Github页面上部署一个网站,该项目是使用create-react-app创建的,并且安装了gh-pages模块。我所有的本地和远程存储库都是最新的,使用npm start在本地主机上启动页面时不会出现任何问题 但是,当我尝试使用npm run deploy将此站点部署到Github页面时,它成功编译,但随后永远挂起gh Pages-d build命令。它将永远持续下去,不会带着错误消息退出,也不会创建错误日志。我想这个命令可能需要很长的时间才能完成,但是我等了30分钟没有结束,所
create-react-app
创建的,并且安装了gh-pages
模块。我所有的本地和远程存储库都是最新的,使用npm start
在本地主机上启动页面时不会出现任何问题
但是,当我尝试使用npm run deploy
将此站点部署到Github页面时,它成功编译,但随后永远挂起gh Pages-d build
命令。它将永远持续下去,不会带着错误消息退出,也不会创建错误日志。我想这个命令可能需要很长的时间才能完成,但是我等了30分钟没有结束,所以我不确定
下面是my package.json:
{
"name": "website",
"version": "0.1.0",
"private": true,
"homepage": "https://xxx.github.io/website",
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.4.0",
"@testing-library/user-event": "^7.2.1",
"gh-pages": "^2.2.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.3.0"
},
"scripts": {
"start": "react-scripts start",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"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"
]
}
}
这是强制终止npm run deploy后的shell日志:
> website@0.1.0 predeploy C:\Users\user\directory
> npm run build
> website@0.1.0 build C:\Users\user\directory
> react-scripts build
Creating an optimized production build...
Compiled successfully.
File sizes after gzip:
40.32 KB build\static\js\2.08db1231.chunk.js
2.9 KB build\static\js\main.0c674757.chunk.js
784 B build\static\js\runtime-main.e77b87bb.js
547 B build\static\css\main.d1b05096.chunk.css
The project was built assuming it is hosted at /website/.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
To publish it at https://xxx.github.io/website , run:
npm run deploy
Find out more about deployment here:
bit.ly/CRA-deploy
> website@0.1.0 deploy C:\Users\user\directory
> gh-pages -d build
顺便说一下,我的github免费帐户状态与任何事情都有关系吗?对于gh页面使用版本
2.0.1
而不是2.2.0
我读了你的帖子并运行了调试器,结果显示命令也在推送时卡住了。然后我尝试将gh页面回滚到2.0.1,但没有改变任何内容:(