pycontw / pycon.tw

PyCon TW Proposal System & Backend Server
https://tw.pycon.org/prs
MIT License
94 stars 107 forks source link

[Deployment] `/usr/local/app/node_modules/.bin/node-sass: not found` #1156

Closed mattwang44 closed 5 months ago

mattwang44 commented 5 months ago

Description

After deploying the 2024 backend on staging environment,

Steps to Reproduce

Expected Behavior

It should display the page (but it does not).

Actual Behavior

500 response. After turning on the debug mode, it shows /usr/local/app/node_modules/.bin/node-sass: not found.

Additional context

It should be the side effect of #1151.

Inside the src/pycontw2016/settings/base.py, the line

COMPRESS_NODE_SASS_BIN = node_bin('node-sass')

expected node-sass executable at the patch /usr/local/app/node_modules/.bin. However, after #1151, the path to the node_modules was moved to /usr/local/lib/node_modules/, which causes the exception. But not sure why we did not encounter this after #1511 (maybe we haven't rebuilt for too long?)

For the current staging environment, I fixed it up with a workaround (but it'll still break after rebuild):

> docker exec -it pycontw-2024 bash -c "cp -r /usr/local/lib/node_modules/ /usr/local/app; ls /usr/local/app"
> docker-compose restart web