1

I am new to nodeJS and I am trying to access SVN using the package svn-spawn. My code is given below.

var Client = require('svn-spawn');
var client = new Client({
    cwd: 'C:\\SVN\\Source Code',
    username: 'abcd', 
    password: 'xyz', 
});
client.getInfo(function(err, data) {
console.log('Repository url is %s', data.url);
});

But I am getting the following error on execution:

console.log('Repository url is %s', data.url);
                                        ^
TypeError: Cannot read property 'url' of undefined
at C:\NodeJS\SvnTest.js:9:45

"data" is undefined.

gvlasov
  • 18,638
  • 21
  • 74
  • 110
  • Try to console.log(err); and console.log(data); – vanadium23 Apr 27 '15 at 13:54
  • On console.log(data) is gives "undefined". On console.log(err), i got the following. { [Error: spawn svn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn svn', path: 'svn' } – Nithin Mohan Apr 27 '15 at 14:06
  • Probably it's because of space in path, try to move to dir without it. Error tells that there is no such folder. – vanadium23 Apr 27 '15 at 14:12
  • 1
    I tried to do that as well. I am still getting the same error. :( – Nithin Mohan Apr 28 '15 at 05:11
  • Another clue that you don't have svn.exe in your %PATH% variable. Try to read this article how to debug this error http://stackoverflow.com/questions/27688804/how-do-i-debug-error-spawn-enoent-on-node-js – vanadium23 Apr 28 '15 at 06:33

1 Answers1

0

Did you install the svn-command tool? It seems the module require you to install svn-command locally, I got the same error and fixed once I install the svn-command tool...

jerryk
  • 1
  • 1