3

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.

6
  • What version of node are you running? Maybe you need a promise polyfill? Commented Jun 6, 2018 at 9:01
  • Install promise using: npm install promise Commented Jun 6, 2018 at 9:03
  • i have node v0.10.40 , and promise 2.0.6 @evolutionxbox Commented Jun 6, 2018 at 9:18
  • v0.10.40? That version is almost 5 years old. Consider upgrading to a version which natively supports promises? Commented Jun 6, 2018 at 9:54
  • Thank you all , the problem was version , when upgrading the new version and now it`s work . @evolutionxbox Commented Jun 6, 2018 at 12:24

2 Answers 2

6

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

Sign up to request clarification or add additional context in comments.

4 Comments

i have var Promise = require('promise'); , it`s not working
Have you installed packages in server: You can do that by cli command: npm i
i do that , but the error steel , i am doing a right command of pull, git.pull('site','site') , or i have to do something else with promise ??
upgrade your node.
-1

Please checked in promise first letter must be capital , I face this problem so many times when I miss the first capital letter.

1 Comment

You can see from the error message that they did in fact use a capital p, so this is not the issue here.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.