1

I just started using node.js for my project and tried making a connection to MySQL and inserting basic values. But I keep getting the following error:

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: Unable to load shared library /Users/****/nodeJS/node_modules/db-mysql/build/Release/mysql_bindings.node
    at Object..node (module.js:472:11)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Module.require (module.js:354:17)
    at require (module.js:370:17)
    at Object.<anonymous> (/Users/****/nodeJS/node_modules/db-mysql/db-mysql.js:18:15)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)

I did as was instructed, I specified the MYSQL_CONFIG environment variable:

$ export MYSQL_CONFIG=/usr/local/mysql/bin/mysql_config

1 Answer 1

2

maybe it's too late and I hope you solved this problem on your own, but it might be useful for other people experiencing the same issue.

What I did to solve it is to set the following variable:

export DYLD_LIBRARY_PATH=<your absolute path to mysql lib folder>

in my case it is:

export DYLD_LIBRARY_PATH=/usr/local/mysql-5.5.25-osx10.6-x86_64/lib/

Tested on MacOS Lion 10.7.4

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.