Skip to content

Issue with saveWidget Function #488

@Billyjac2002

Description

@Billyjac2002

I am encountering an error when trying to save a widget using the saveWidget function from the htmlwidgets package. The error message is: Error in .getNamespace(pkg) :
invalid type/length (symbol/0) in vector allocation

This error occurs even with minimal HTML content and different widgets.

Reproducible Example

# Load required libraries
library(leaflet)
library(htmltools)
library(htmlwidgets)

# Create a simple map
map <- leaflet() %>%
  addProviderTiles(providers$OpenStreetMap.Mapnik) %>%
  addMarkers(lng = 174.768, lat = -36.852, popup = "The birthplace of R")

# Minimal HTML content
minimal_html <- tags$p("Test paragraph")

# Test saving with minimal HTML content
html_file_minimal <- "test_route_assessment_map_minimal.html"
saveWidget(
  tagList(minimal_html, map), 
  html_file_minimal, 
  selfcontained = TRUE
)

**Steps Taken**

- Reinstalled all necessary packages.
- Tested with minimal HTML content.
- Tried different CRAN mirrors.
- Checked for package updates.
- Ran the code on a fresh R installation.
- Tested on a different machine/environment.
- Environment
- R version: 4.4.1
- Operating System: Windows 11 x64 (build 22631)

**Packages:**

- leaflet: 2.2.2
- htmltools: 0.5.8.1
- htmlwidgets: 1.6.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions