Node application moves node_modules and creates symlink, breaking local packages

Charlie Fink 1 Reputation point
2022-05-19T02:05:58.8+00:00

Using a basic linux app service, when I deploy my node application, it seems that the node_modules folder is moved from /home/site/wwwroot/node_modules to /node_modules, and a symlink is created under /home/site/wwwroot. This breaks local packages.

Has anyone else experienced this, and is there a fix?

Here is ls under /home/site/wwwroot:
203451-image.png

Local modules under node__modules are symlinked w/ relative paths, which is now broken.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,920 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 25,981 Reputation points Microsoft Employee
    2022-05-21T03:31:25.753+00:00

    Apologies for the delayed response @Charlie Fink .

    This is dependent on the startup script generated by the app service. You can find by navigating to /opt/startup/startup.sh. Depending on how your How exactly are you deploying your app? If you're doing a zip deploy, that may be what's going. The app service will use /node_modules extracted from the zip to the local disk and create a symlink so your app on /home can find the modules.

    You can always let the app service build the app by enabling SCM_DO_BUILD_DURING_DEPLOYMENT? Have a look Customize build automation for more information on how to set that up.