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.

3 comments:

  1. hi..the latest version from node isn't full compatible with cs..the node_stdio module ws removed...a simple way for fix it is open /usr/local/lib/node_modules/coffee-script/lib/command.js and change the line 15

    process.binding('stdio').writeError(line + '\n')

    for

    process.stderr.write(line + '\n')

    always you can get more help from github issues section
    https://github.com/jashkenas/coffee-script/commit/c77f7737a5d94a05a999109810ea7634f540e1e2

    good luck and happy coding

    ReplyDelete
  2. Thanks for the tip - I didn't think it was a node problem since I was running the stable version (0.4.x?) recommended by the cs docs. It is still a mystery as too why this happened but it is working now.

    ReplyDelete
  3. actually isn't a node problem...node only did changes in the modules..but it become incompatible with the latest coffee version...many post says than you need use a previous version for node while coffescript solves the incompatibility but I've no found any other problem except this

    ReplyDelete