ReferenceError:未定义 Promise

Ahm*_*shd 3 git nodes node.js server

推送我的数据后,我尝试从另一台服务器使用 git.pull('site','site') 但出现此错误。

 ReferenceError: Promise is not defined
at deferred (/root/home/flash/Site/node_modules/simple-git/src/util/deferred.js:4:20)
at Git._schedule (/root/home/flash/Site/node_modules/simple-git/src/git.js:1363:23)
at Git._run (/root/home/flash/Site/node_modules/simple-git/src/git.js:1346:12)
at Git.pull (/root/home/flash/Site/node_modules/simple-git/src/git.js:337:19)
at port (/root/home/flash/Site/server.js:588:11)
at Layer.handle [as handle_request] (/root/home/flash/Site/node_modules/express/lib/router/layer.js:95:5)
at next (/root/home/flash/Site/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/root/home/flash/Site/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/root/home/flash/Site/node_modules/express/lib/router/layer.js:95:5)
at /root/home/flash/Site/node_modules/express/lib/router/index.js:281:22
Run Code Online (Sandbox Code Playgroud)

如何提取我的数据?

*注意:当我在控制台中手动键入命令时,它可以工作(git pull site site)。

有人可以帮我解决这个问题吗?

小智 6

你只需要使用 cli 安装 Promise:

npm install promise
Run Code Online (Sandbox Code Playgroud)

然后将其添加到您的代码中:

var Promise = require('promise');
Run Code Online (Sandbox Code Playgroud)

有关更多详细信息,请访问:https://www.npmjs.com/package/nodegit-promise