无法部署到 github 个页面
Unable to Deploy to github pages
当我尝试部署我的应用程序时(之前没有问题)
已经删除 node_modules 和 运行 npm install 但问题仍然存在。
也尝试在新存储库中复制该应用程序并遇到同样的问题
我有以下错误
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
您似乎在 github 上没有任何名为 api-dog
的 public 存储库。您首先需要将此回购推送到 github,然后 运行 您的 deploy
脚本。
我遇到了同样的问题。对我有用的是 first
git remote remove origin
然后以这种格式而不是 git@github 格式创建一个新的遥控器:
git remote add https://github.com/username/repo-name.git
这似乎是 issue 的最新版本 gh-pages
(3.2.1)。我有同样的问题,我降级到版本 3.1.0 并解决了问题。
我遇到了同样的问题,唯一的解决办法是降级gh-pages的版本。
您可以在 package.json 中对我在版本 (3.2.0) 中的旧版本进行操作。
这是 github 中 issue 的 link。
当我尝试部署我的应用程序时(之前没有问题) 已经删除 node_modules 和 运行 npm install 但问题仍然存在。
也尝试在新存储库中复制该应用程序并遇到同样的问题 我有以下错误
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
您似乎在 github 上没有任何名为 api-dog
的 public 存储库。您首先需要将此回购推送到 github,然后 运行 您的 deploy
脚本。
我遇到了同样的问题。对我有用的是 first
git remote remove origin
然后以这种格式而不是 git@github 格式创建一个新的遥控器:
git remote add https://github.com/username/repo-name.git
这似乎是 issue 的最新版本 gh-pages
(3.2.1)。我有同样的问题,我降级到版本 3.1.0 并解决了问题。
我遇到了同样的问题,唯一的解决办法是降级gh-pages的版本。 您可以在 package.json 中对我在版本 (3.2.0) 中的旧版本进行操作。 这是 github 中 issue 的 link。