Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deployed code messes up the symlinks and app can't start

See original GitHub issue

I’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

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:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

0gust1commented, Sep 17, 2020

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 :

I did a quick and dirty workaround in my github action, just before the azure/webapps-deploy step.

- name: HACK - copy symbolic link to directory (Azure & symbolic links...)
      working-directory: ./backend
      run: cp -Lr node_modules/dependency/symlinked node_modules/dependency/symlinked-COPY && rm node_modules/dependency/symlinked && mv node_modules/dependency/symlinked-COPY node_modules/dependency/symlinked
cartermcommented, Oct 29, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

The trouble with symbolic links -
Most applications will not have to care whether there's a directory symlink in the path, even if Samba needs to do its own...
Read more >
Perforce messes up symlinks - Stack Overflow
The simple solution in most cases should be to start P4V as administrator and then download the source code.
Read more >
Symbolic Links for Easier Multi-Folder Local Development
Ideally, I'd have just my theme folder open in my code editor (no need to have the entire WordPress root there, that would...
Read more >
Link Shell Extension (LSE)
Hardlinks, Junctions and Symbolic Links are NOT supported on FAT file systems, ... Windows Defender SmartScreen prevented an unrecognized app from starting.
Read more >
Windows 10 2004 broken symlinks when deploying image ...
created base image in HyperV machine, installed some basic apps, ... tje wromg drive letter even after reboot the junctions are messed up....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found