fixing dlopen “no suitable image found” errors with node, sass and grunt

I ran in to this error today:

$ grunt css
Loading “sass.js” tasks…ERROR
>> Error: dlopen(/path/to/project/node_modules/grunt-sass/node_modules/node-sass/vendor/darwin-x64-node-0.12/binding.node, 1): no suitable image found. Did find:
>> /path/to/project/node_modules/grunt-sass/node_modules/node-sass/vendor/darwin-x64-node-0.12/binding.node: truncated mach-o error: segment __LINKEDIT extends to 1765408 which is past end of file 1765309

Running “sass:theme” (sass) task
OptionParser::InvalidOption: invalid option: –image-path=assets/img
Use –trace for backtrace.
OptionParser::InvalidOption: invalid option: –image-path=assets/img
Use –trace for backtrace.
OptionParser::InvalidOption: invalid option: –image-path=assets/img
Use –trace for backtrace.
Warning: Exited with error code 1 Use –force to continue.

Aborted due to warnings.

For those curious, this is dyld failing to open a shared library. (See man dlopen.)

I checked and the file exists:

$ file /path/to/project/node_modules/grunt-sass/node_modules/node-sass/vendor/darwin-x64-node-0.12/binding.node
/path/to/project/node_modules/grunt-sass/node_modules/node-sass/vendor/darwin-x64-node-0.12/binding.node: Mach-O 64-bit bundle x86_64

Reinstalling fixed things:

$ rm -rf node_modules/grunt-sass
$ npm install
/
> node-sass@2.1.1 install /path/to/project/node_modules/grunt-sass/node_modules/node-sass
> node scripts/install.js

> node-sass@2.1.1 postinstall /path/to/project/node_modules/grunt-sass/node_modules/node-sass
> node scripts/build.js

`darwin-x64-node-0.12` exists; testing
Binary is fine; exiting
grunt-sass@0.18.1 node_modules/grunt-sass
├── object-assign@2.1.1
├── each-async@1.1.1 (set-immediate-shim@1.0.1, onetime@1.0.0)
└── node-sass@2.1.1 (get-stdin@4.0.1, replace-ext@0.0.1, nan@1.8.4, semver@4.3.6, shelljs@0.3.0, cross-spawn@0.2.9, chalk@0.5.1, mkdirp@0.5.1, npmconf@2.1.2, meow@3.3.0, gaze@0.5.1, mocha@2.2.5, sass-graph@1.3.0, request@2.58.0, pangyp@2.2.1)

One Response to fixing dlopen “no suitable image found” errors with node, sass and grunt

  1. will says:

    Thanks for the fix!

Leave a Reply

Your email address will not be published. Required fields are marked *