I am not able to install "devtools" package on window PC

I am unable to install the package "devtools" on Window PC. I am pasting the error here:

Installing package into ‘C:/Users/Lenovo/OneDrive/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
also installing the dependency ‘cli’

There is a binary version available but the source version is later:
binary source needs_compilation
devtools 2.4.4 2.4.5 FALSE

trying URL 'https://mirror.niser.ac.in/cran/bin/windows/contrib/4.1/cli_3.4.1.zip'
Content type 'application/zip' length 1307617 bytes (1.2 MB)
downloaded 1.2 MB

package ‘cli’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package ‘cli’
Warning: restored ‘cli’

The downloaded binary packages are in
installing the source package ‘devtools’

trying URL 'https://mirror.niser.ac.in/cran/src/contrib/devtools_2.4.5.tar.gz'
Content type 'application/x-gzip' length 374718 bytes (365 KB)
downloaded 365 KB

  • installing source package 'devtools' ...
    ** package 'devtools' successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
    namespace 'cli' 3.2.0 is already loaded, but >= 3.3.0 is required
    Calls: ... namespaceImportFrom -> asNamespace -> loadNamespace
    Execution halted
    ERROR: lazy loading failed for package 'devtools'
  • removing 'C:/Users/Lenovo/OneDrive/Documents/R/win-library/4.1/devtools'

The downloaded source packages are in
Warning messages:
1: In file.copy(savedcopy, lib, recursive = TRUE) :
problem copying C:\Users\Lenovo\OneDrive\Documents\R\win-library\4.1\00LOCK\cli\libs\x64\cli.dll to C:\Users\Lenovo\OneDrive\Documents\R\win-library\4.1\cli\libs\x64\cli.dll: Permission denied
2: In install.packages("devtools") :
installation of package ‘devtools’ had non-zero exit status

It seems cli is already loaded in your environment and this prevents it from updating. Try restarting your R session before installing the package, if this doesn't work, manually delete the cli package and reinstall.

Thanks... it's working now after deleting the cli packages and then install the package devtools.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.