2

I have a markdown doc that includes several embedded inline shiny apps. It runs fine on my local machine, but I can't deploy to shinyapps.io. The problem seems to be related to the nloptr package, which is a dependency of piecewiseSEM and several other common packages. I don't really know what the root cause is, but it seems that nloptr requires the cmake utility, which is not found on the shinyapps server. How do I get around this?

reprex (apologies for the formatting, not sure how the escape characters work):

---
title: "shiny-reprex"
author: "Anson Call"
date: "2022/02/08"
output:
  html_document:
    toc: yes
    toc_depth: 6
runtime: shiny
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(piecewiseSEM)

```{r cars}
  shinyApp(
    ui = fluidPage(
      numericInput("n", "n", 1),
      plotOutput("plot")
    ),
    server = function(input, output, session) {
      output$plot <- renderPlot( plot(head(cars, input$n)) )
    }
  )

I clipped this text from the console during the attempted deployment, which seems relevant:

...
using NLopt via local cmake build on x86_64 

------------------ CMAKE NOT FOUND --------------------

CMake was not found on the PATH. Please install CMake:
...

and finally the error message, after the deployment fails:

/usr/bin/ld: cannot find -lnlopt
collect2: error: ld returned 1 exit status
make: *** [/opt/R/4.1.2/lib/R/share/make/shlib.mk:10: nloptr.so] Error 1
ERROR: compilation failed for package ‘nloptr’
* removing ‘/opt/R/4.1.2/lib/R/library/nloptr’
################################# End Task Log ################################# 
Error: Unhandled Exception: Child Task 1097159045 failed: Error building image: Build exited with non-zero status: 1
Execution halted

any advice?

Anson Call
  • 146
  • 1
  • 7

0 Answers0