You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

将Rmarkdown发布到Shiny Server上的Blogdown后图表不显示

解决Blogdown部署到Shiny Server后图表不显示的问题

Hey there! Let's figure out why your Rmarkdown charts aren't showing up after deploying your Blogdown site to Shiny Server. Based on the details you shared, here are the most practical fixes to try:

1. 排查文件权限问题

Shiny Server runs under the shiny user by default, but your public folder lives in /home/runrunwei/GitRepo/MySite/—it’s super likely the shiny user doesn’t have read access to this directory chain.

  • First, set the correct permissions to let the shiny user traverse and read your files:
    sudo chmod -R o+r /home/runrunwei/GitRepo/MySite/
    sudo chmod o+x /home/runrunwei/
    sudo chmod o+x /home/runrunwei/GitRepo/
    sudo chmod o+x /home/runrunwei/GitRepo/MySite/
    
  • Test if the shiny user can access your post files directly:
    sudo -u shiny ls /home/runrunwei/GitRepo/MySite/public/post/
    
    If this throws an error, the permission fix above should resolve it.

2. Verify chart file paths are correct

Blogdown stores Rmarkdown charts in paths like public/post/[your-post-name]/index_files/figure-html/. When using a symlink with Shiny Server, relative paths might break.

  • Open your browser’s developer tools (F12), go to the Network tab, then refresh your site:
    • If chart requests show a 404 error, the path mapping is off. Try setting baseurl = "/bi/" in your Blogdown config.toml (or config.yaml), rebuild the site with blogdown::build_site(), then update your public folder.

3. Check Shiny Server logs for specific errors

Logs will tell you exactly what’s going wrong—like permission denials or missing files.

  • View the latest log entries for your site:
    sudo tail -n 20 /var/log/shiny-server/bi.log
    
    (If bi.log doesn’t exist, check other files in /var/log/shiny-server/.) Look for keywords like Permission denied or File not found to pinpoint the issue.

Symlinks can sometimes cause permission or mapping headaches. If the above steps don’t work, copy the folder directly:

sudo cp -r /home/runrunwei/GitRepo/MySite/public/ /srv/shiny-server/bi/

Just re-copy the folder whenever you update your site—this avoids symlink-related issues entirely.

Give these steps a shot, and your charts should start showing up in no time!

内容的提问来源于stack exchange,提问作者Rain.Wei

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:28:25