[英]Can not run 'npm run build' / 'npm run deploy' command in my react app
我嘗試使用 npm run deploy 在 github-pages 上部署我的 react 項目,但出現以下錯誤:
events.js:167
throw er; // Unhandled 'error' event
^
Error: spawn git ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
at onErrorNT (internal/child_process.js:407:16)
[... lines matching original stack trace ...]
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! songs@0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the songs@0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
我已經使用了npm cache clean
、deleted node modules 和 package-lock.json 並再次運行npm install
。 我是 React 和編程的新手,所以我無法真正弄清楚問題是什么。 另外,我應該提到我是 Windows 用戶。 任何幫助將非常感激。
解決方案是設置環境變量 $PATH。 我按照這里提到的步驟操作: 如何在 node.js 上調試“錯誤:生成 ENOENT”?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.