简体   繁体   中英

Azure Web App unable to install NodeJS mysql dependency

I recently created a web app on Azure, I am able to run it well, however I noticed that if I add the following line

const mysql = require('mysql');

the app will crash as it is not able to find the mysql module. When I test the app locally on my machine I have no such problem, it only occurs when the app is deployed to Azure. Notice that the Azure app works well with other dependencies, but it fails in installing mysql.

What am I doing wrong? Any hint is more than welcomed. Thanks in advance!

After reproducing from our end we noticed that mysql is not visible in the node modules. In general, npm install works locally. To make it work even after deployment ensure mysql module is being installed in ./node_modules of the application.

You can navigate to Kudu of your Web app and use npm install mysql . Even after doing that if you still cant find the module in the nodemodules, then just drag and drop the module from your local machine.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM