Monday, November 21, 2011

On CoffeeScript, PostgreSQL 8.4 and Subversion

I had installed PostgreSQL 8.4 on my MacBook runnning Lion (10.7.2) for a new project I had started. After this installation my command line svn stopped working with the following error:

dyld: Library not loaded: /usr/lib/libpq.5.dylib
  Referenced from: /usr/bin/svn
  Reason: image not found
Trace/BPT trap: 5

A number of google searches later I was still stuck. Then I noticed that CoffeeScript was now broken as well - I would get the following error when I was building my project:

/usr/local/lib/node_modules/coffee-script/lib/command.js:15
    return process.binding('stdio').writeError(line + '\n');
                   ^
Error: No such module
    at /usr/local/lib/node_modules/coffee-script/lib/command.js:15:20
    at /usr/local/lib/node_modules/coffee-script/lib/command.js:167:7
    at /usr/local/lib/node_modules/coffee-script/lib/command.js:115:26
    at [object Object]. (fs.js:114:5)
    at [object Object].emit (events.js:64:17)
    at afterRead (fs.js:1080:12)
    at Object.wrapper [as oncomplete] (fs.js:252:17)

This was really annoying since much of what I do is writing code, testing code, and then checking it in - when the tools necessary to do two of those steps don't work I can't get much done. Google searches for the CoffeeScript problem also didn't really turn up much except for a messed up NODE_PATH variable. Finally, in an act of desperation I reran "sudo npm install -g coffee-script" and suddenly everything started working again. This fixing the CoffeeScript error I understand - I have no idea how this resolved the svn issue.


UPDATE

So the issue came back and the coffee install trick noted above did not work this time.

A little investigation showed that /usr/lib/libpq.5.dylib was a link pointing to /usr/local/pgsql/lib/libpq.5.dylib which no longer existed. I did notice that /usr/lib/libpq.5.3.dylib was there so I just pointed /usr/local/pgsql/lib/libpq.5.dylib to /usr/lib/libpq.5.3.dylib and svn was working again.