Mysql-libmysqlclient of Nodejs Installation module

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.