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
/
> [email protected] install /path/to/project/node_modules/grunt-sass/node_modules/node-sass
> node scripts/install.js

> [email protected] 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
[email protected] node_modules/grunt-sass
├── [email protected]
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

Join the Conversation

1 Comment

Leave a comment

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