'Installing package from local file - Error in startsWith(contriburl, "file:") : non-character object(s)

I downloaded rJava package rJava_1.0-6.tar.gz and trying to install it locally:

install.packages('rJava_1.0-6.tar.gz', repos = NULL, type = "source")

I get back the following error:

Installing package into ‘C:/some_project_path/renv/library/R-4.0/x86_64-w64-mingw32’
(as ‘lib’ is unspecified)
Error in startsWith(contriburl, "file:") : non-character object(s)

I thought this is due to renv and tried:

renv::install('rJava_1.0-6.tar.gz', type = 'source')

but got back:

Error: failed to resolve remote 'rJava_1.0-6.tar.gz' -- failed to parse remote spec 'rJava_1.0-6.tar.gz'

Update:

traceback() after install.packages('rJava_1.0-6.tar.gz', repos = NULL, type = "source") returns:

6: startsWith(contriburl, "file:")
5: utils::install.packages(pkgs = pkgs, lib = lib, repos = repos, 
       contriburl = contriburl, method = method, available = available, 
       destdir = destdir, dependencies = dependencies, type = type, 
       configure.args = configure.args, configure.vars = configure.vars, 
       clean = clean, Ncpus = Ncpus, verbose = verbose, libs_only = libs_only, 
       INSTALL_opts = INSTALL_opts, quiet = quiet, keep_outputs = keep_outputs, 
       ...)
4: eval(call, envir = parent.frame())
3: eval(call, envir = parent.frame())
2: delegate(utils::install.packages)
1: install.packages("rJava_1.0-6.tar.gz", repos = NULL, type = "source")

list.files() shows my file "rJava_1.0-6.tar.gz"



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source