[英]Unable to Deploy to github pages
当我尝试部署我的应用程序时(在没有问题之前)已经删除了 node_modules 并运行 npm 安装但问题仍然存在。
还尝试在新存储库中复制应用程序并遇到相同的问题我有以下错误
Invalid URL: http:git@github.com:caarlosdamian/api-dog.git
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! api-dog@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the api-dog@0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
package.json
{
"homepage": "http://caarlosdamian.github.io/api-dog",
"name": "api-dog",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"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.2.1"
}
}
更新更改名称并克隆存储库并出现此错误
carlos@DESKTOP-1FHUBQI:~/dog-api$ npm run deploy
> dog-api@0.1.0 predeploy
> npm run build
> dog-api@0.1.0 build
> react-scripts build
Creating an optimized production build...
Compiled successfully.
File sizes after gzip:
43.93 KB build/static/js/2.c6054aff.chunk.js
1.26 KB build/static/js/main.be6d3320.chunk.js
1.21 KB build/static/css/main.4aa46507.chunk.css
785 B build/static/js/runtime-main.cdafbc59.js
The project was built assuming it is hosted at /applicationtest/.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
Find out more about deployment here:
https://cra.link/deployment
> dog-api@0.1.0 deploy
> gh-pages -d build
Invalid URL: http:git@github.com:caarlosdamian/applicationtest.git
我面临着同样的问题。 对我有用的是首先
git remote remove origin
然后以这种格式而不是 git@github 格式创建一个新的远程:
git remote add https://github.com/username/repo-name.git
看来您在 github 上没有任何名为api-dog
公共存储库。 您首先需要将此 repo 推送到 github,然后运行您的deploy
脚本。
这似乎是最新版本的gh-pages
(3.2.1) 的问题。 我有同样的问题,我降级到版本 3.1.0 并且问题已修复。
我遇到了同样的问题,唯一的解决方案是降级 gh-pages 的版本。 您可以在package.json中使用旧版本(3.2.0)中的旧版本进行操作。 这是github中问题的链接。
ON 部署反应应用程序不发布
节点:事件:491 抛出 er; // 未处理的“错误”事件 ^
错误:在 processTicksAndRejections (node:internal/process/task_queues:83: 21)在 ChildProcess 实例上发出“错误”事件:在 ProcessTicksAndRejections(节点:internal /process/task_queues:83:21) { errno: -4058, code: 'ENOENT', syscall: 'spawn git', path: 'git', spawnargs: ['config', 'user.name']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.