node.jsgitservernodes

ReferenceError: Promise is not defined


after pushing my data , i am trying to use from another server git.pull('site','site') but i get this Error.

 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

how to pull my data ??

*Note : When I type the command manually in the console it works (git pull site site) .

can someone help me please to solve this problem.


Solution

  • You just need to install promise using cli:

    npm install promise
    

    Then add this to your code:

    var Promise = require('promise');
    

    For more detail go to: https://www.npmjs.com/package/nodegit-promise