当我尝试使用npm run deploy时,我不断收到此错误消息。
但是,我的package.json文件中似乎确实有一个部署脚本
我也进入了package.json目录
我尝试打开github页面,但是当我转到链接时,它给我一个404错误
结果,我关闭了github页面
扩展错误消息(npm调试日志):
14 verbose lifecycle myportfoliosite@0.1.0~deploy: CWD: C:\Users\Ali Haider\AppData\Roaming\npm\node_modules\create-react-app\myportfoliosite\myportfoliosite
15 silly lifecycle myportfoliosite@0.1.0~deploy: Args: [ '/d /s /c', 'gh-pages -d build' ]
16 silly lifecycle myportfoliosite@0.1.0~deploy: Returned: code: 1 signal: null
17 info lifecycle myportfoliosite@0.1.0~deploy: Failed to exec deploy script
18 verbose stack Error: myportfoliosite@0.1.0 deploy: `gh-pages -d build`
18 verbose stack Exit status 1
18 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
18 verbose stack at EventEmitter.emit (events.js:198:13)
18 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
18 verbose stack at ChildProcess.emit (events.js:198:13)
18 verbose stack at maybeClose (internal/child_process.js:982:16)
18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
19 verbose pkgid myportfoliosite@0.1.0
20 verbose cwd C:\Users\Ali Haider\AppData\Roaming\npm\node_modules\create-react-app\myportfoliosite\myportfoliosite
21 verbose Windows_NT 10.0.17134
22 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "deploy"
23 verbose node v10.16.0
24 verbose npm v6.9.0
25 error code ELIFECYCLE
26 error errno 1
27 error myportfoliosite@0.1.0 deploy: `gh-pages -d build`
27 error Exit status 1
28 error Failed at the myportfoliosite@0.1.0 deploy script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 1, true ]
File sizes after gzip:
73.02 KB build\static\js\2.f6e5e996.chunk.js
19.04 KB build\static\css\2.b1979bb4.chunk.css
797 B build\static\js\runtime~main.4f085a03.js
152 B build\static\js\main.a0a932a3.chunk.js
The project was built assuming it is hosted at /InquisitiveDev2016/ReactDeveloperPortfolio/.
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:
错误出现在终端上:
> myportfoliosite@0.1.0 deploy C:\Users\Ali Haider\AppData\Roaming\npm\node_modules\create-react-app\myportfoliosite\myportfoliosite
> gh-pages -d build
'gh-pages' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myportfoliosite@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myportfoliosite@0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ali Haider\AppData\Roaming\npm-cache\_logs\2019-06-29T02_08_30_836Z-debug.log
这是我的存储库:https://github.com/InquisitiveDev2016/ReactDeveloperPortfolio
我的json文件夹:
{
"name": "myportfoliosite",
"version": "0.1.0",
"private": true,
"homepage": "https://github.com/InquisitiveDev2016/ReactDeveloperPortfolio",
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-mdl": "^1.11.0",
"react-router-dom": "^5.0.1",
"react-scripts": "3.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"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"
]
}
}