Deployed code messes up the symlinks and app can't start
See original GitHub issueI’m deploying a nodeJS app with Github actions and it seems that once the code gets to the azure web app server the symlinks from within node_modules/.bin folder are all messed up and app doesn’t start.
For example when I run my code locally, if I do a node ./node_modules/.bin/next --help
it works, and ./node_modules/.bin/next
is actually a symlink to ../next/dist/bin/next
But after code is deployed on Azure with the webapps-deploy action it seems that ./node_modules/.bin/next
is no longer a symlink to ../next/dist/bin/next
but it actually becomes a text file with ../next/dist/bin/next
as its contents and so if I connect to ssh to the Azure server and run node ./node_modules/.bin/next --help
(same command I run locally, or that also works ok inside the GitHub action, there I get an error:
/home/site/wwwroot>node ./node_modules/.bin/next --help
/home/site/wwwroot/node_modules/.bin/next:1
../next/dist/bin/next
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:1047:16)
at Module._compile (internal/modules/cjs/loader.js:1097:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:8 (3 by maintainers)
Top GitHub Comments
Had same kind of issue too.
In my case I have a dependency that is a symbolic link to another folder of the repo (it’s a monorepo).
Root cause may be linked to the App service sandbox model : https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#symbolic-link-creation
I did a quick and dirty workaround in my github action, just before the
azure/webapps-deploy
step.npm install $(npm pack <folder> | tail -1)
https://stackoverflow.com/questions/21425980/npm-install-without-symlinks-option-not-working