无法运行npm运行构建/部署

时间:2018-11-26 10:43:23

标签: npm

我尝试使用npm run deploy将我的react项目部署在github-pages上,但出现以下错误:

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,删除了节点模块和package-lock.json并再次运行npm install。我是React和一般编程人员的新手,所以我无法真正弄清问题所在。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

解决方案是设置环境变量$ PATH。我遵循此处提到的步骤:How do I debug “Error: spawn ENOENT” on node.js?