question

CharlieFink-4030 avatar image
0 Votes"
CharlieFink-4030 asked CharlieFink-4030 commented

Node application moves node_modules and creates symlink, breaking local packages

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-webapps
image.png (10.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ryanchill avatar image
0 Votes"
ryanchill answered CharlieFink-4030 commented

Apologies for the delayed response @CharlieFink-4030.

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.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Ryan:

Thanks for the answer here.

I reviewed the file at /opt/startup/startup.sh - I had no idea that was the kickoff point (although I'm sure it's documented), so this removes some of the mystery.

My choice for a path at this point is to:

  1. Leave startup.sh as is.

  2. Use a node script that re-points the links under /node_modues to point to the righ place. (In my case, a couple scoped package)

This works in the current setup and seems to me to have a high likelihood of stability in the future, as it does a minimum to change the current deploy behavior. I welcome your thoughts if you have a better solution.

Thanks!
Charlie

0 Votes 0 ·