更新
我尝试使用cmder而不是powershell进行部署,但它确实有效!现在,当我最初设置一切时,我正在使用cmder,所以我不确定这是不是原因......但我不知道为什么它会在powershell下破解。
一切正常,我能够构建我的react-app并将其部署到github然后突然间我上周开始遇到错误每当我尝试运行时npm run deploy
以下是我收到的错误摘录:
Powershell的
> gh-pages -d build
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn git ENOENT
at exports._errnoException (util.js:1020:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app@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\Spiderman\AppData\Roaming\npm-cache\_logs\2017-08-15T00_44_09_227Z-debug.log
需要注意的一点是,节点安装在D:驱动器上,所有我的反应文件都是如此。但看起来npm部分安装在C:驱动器上。
无论如何,这里是完整的日志我已经缩小到这里:
调试日志
1 info lifecycle app@0.1.0~deploy: app@0.1.0
12 verbose lifecycle app@0.1.0~deploy: unsafe-perm in lifecycle true
13 verbose lifecycle app@0.1.0~deploy: PATH: C:\Users\Spiderman\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;D:\Users\Spiderman\Websites\PB\app\node_modules\.bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;D:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Windows Live\Shared;D:\Program Files (x86)\Brackets\command;D:\Program Files\Git LFS;D:\Program Files\OpenVPN\bin;D:\Program Files\nodejs\;D:\Python34;D:\Program Files\Heroku\bin;C:\Users\Spiderman\AppData\Local\atom\bin;C:\Users\Spiderman\AppData\Roaming\npm
14 verbose lifecycle app@0.1.0~deploy: CWD: D:\Users\Spiderman\Websites\PB\app
15 silly lifecycle app@0.1.0~deploy: Args: [ '/d /s /c', 'gh-pages -d build' ]
16 silly lifecycle app@0.1.0~deploy: Returned: code: 1 signal: null
17 info lifecycle app@0.1.0~deploy: Failed to exec deploy script
18 verbose stack Error: app@0.1.0 deploy: `gh-pages -d build`
18 verbose stack Exit status 1
18 verbose stack at EventEmitter.<anonymous> (C:\Users\Spiderman\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:289:16)
18 verbose stack at emitTwo (events.js:106:13)
18 verbose stack at EventEmitter.emit (events.js:191:7)
18 verbose stack at ChildProcess.<anonymous> (C:\Users\Spiderman\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
18 verbose stack at emitTwo (events.js:106:13)
18 verbose stack at ChildProcess.emit (events.js:191:7)
18 verbose stack at maybeClose (internal/child_process.js:891:16)
18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
19 verbose pkgid app@0.1.0
20 verbose cwd D:\Users\Spiderman\Websites\PB\app
21 verbose Windows_NT 6.3.9600
22 verbose argv "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Spiderman\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "deploy"
23 verbose node v6.11.2
24 verbose npm v5.1.0
25 error code ELIFECYCLE
26 error errno 1
27 error app@0.1.0 deploy: `gh-pages -d build`
27 error Exit status 1
28 error Failed at the app@0.1.0 deploy script
https://pastebin.com/gYr9PKtj PS我在运行电源外壳的Windows上。
的package.json
{
"name": "app",
"version": "0.1.0",
"private": true,
"homepage": "https://hidden.github.io/hideen/",
"dependencies": {
"firebase": "^4.1.3",
"gh-pages": "^1.0.0",
"re-base": "^3.0.2",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-router": "^4.1.1",
"react-router-dom": "^4.1.1",
"react-scripts": "1.0.10",
"react-transition-group": "^1.2.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
}
}