My node module is no longer working after updating to Maverick

Before installing Maverick my app worked well. After installing Maverick when i typed nodemon app.js in terminal it no longer worked so I reinstalled node and then npm uninstall nodemon followed by npm install nodemonto reinstall it. This worked well, and nodemon now works. Unfortunately now I have a new bug that I can't resolve. When uploading images in my app I get

TypeError: Cannot read property 'width' of undefined

        var gm = require('gm').subClass({ imageMagick: true }); 
        gm(target_path).size(function (err, size) {//shrinks and replaces large images
          if (size.width > 700 || size.height > 700) {  
            gm(target_path).scale(700, 700).autoOrient().write(target_path, function (err) {
              if (!err) console.log('shrunk! ');
            });
          }
        });

If I comment it out, and then just load up a page with an image I then get

Error: spawn ENOENT
    at errnoException (child_process.js:1001:11)
    at Process.ChildProcess._handle.onexit (child_process.js:792:34)
2 Oct 17:30:21 - [nodemon] app crashed - waiting for file changes before starting...

I have uninstalled and resinstalled fs, gm, imagemagick, jquery, and just about all my modules with no success. I have the following within usr/local/lib/node_modules and within my node_modules directory inside my project minus node and npm.

 $ ls
    bcrypt-nodejs   consolidate express     fs      gm      imagemagick jquery      mongodb     node-fs     nodemon     npm

Still getting this:

/Users/Squirrel/Documents/Code/Memry/Memry_11-8/routes/content.js:605
                  if (size.width > 700 || size.height > 700) {  
                          ^
TypeError: Cannot read property 'width' of undefined
    at gm.<anonymous> (/Users/Squirrel/Documents/Code/Memry/Memry_11-8/routes/content.js:605:15)
    at gm.emit (events.js:106:17)
    at gm.<anonymous> (/Users/Squirrel/Documents/Code/Memry/Memry_11-8/node_modules/gm/lib/getters.js:70:16)
    at cb (/Users/Squirrel/Documents/Code/Memry/Memry_11-8/node_modules/gm/lib/command.js:265:16)
    at ChildProcess._spawn.proc.on.onExit (/Users/Squirrel/Documents/Code/Memry/Memry_11-8/node_modules/gm/lib/command.js:247:9)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Socket.<anonymous> (child_process.js:969:11)
    at Socket.emit (events.js:95:17)
    at Pipe.close (net.js:465:12)
3 Oct 11:58:43 - [nodemon] app crashed - waiting for file changes before starting..

GraphicsMagick seems to have been uninstalled in the upgrade process, so you will need to reinstall it for the gm node module to work since it is just a simple wrapper around the command-line binary gm.

To install GraphicsMagick the system library and command-line utility, here are some options:

  • Install via homebrew with: brew install graphicsmagick

  • Install via macports with: port install graphicsmagick

  • Download, compile, and install GM manually.