Because you need to use the Mysql-libmysqlclient module, run the following command to install
NPM Install Mysql-libmysqlclient
The error is as follows:
This is because the directory for some environment variables for MySQL is not configured well.
install MySQL first, how to install Mac here do not elaborate, MySQL's official website has a dedicated Mac DMG package download, to the official website to download, and then with the mouse to poke a few of the good
then add the MySQL Bin directory to the environment variable in path and execute the following command:
Export path= $PATH:/usr/local/mysql/bin/
Add the MySQL lib directory to the environment variable Dyld_library_path and execute the following command:
Export Dyld_library_path=/usr/local/mysql/lib: $DYLD _library_path
It is important to note that the addition of environment variables, after the restart of the machine has been invalidated, so it needs to be set to the start of each boot, will automatically perform the above changes to the environment variables, the following command to execute:
Export path= "$PATH:/usr/local/mysql/bin" Export dyld_library_path= "/usr/local/mysql/lib: $DYLD _library_path"
To continue executing the command:
NPM Install Mysql-libmysqlclient
To install the Mysql-libmysqlclient module, the installation succeeds, but when the module is called in Nodejs, the following error is reported:
Google for a long time, to find the cause of the problem, because NPM install the module, the need to use the MySQL library libmysqlclient.18.dylib file, and NPM default that directory is/usr/lib, Execute the following command to generate a soft link on the line:
sudo ln-s/usr/local/mysql/lib/libmysqlclient.18.dylib/usr/lib/libmysqlclient.18.dylib
Then uninstall the module and re-install it, OK.
Mysql-libmysqlclient of Nodejs Installation module