无法安装软件包“stringi”,错误:没有名为“stringi”的软件包(在 R 中)

问题描述 投票:0回答:1

我一直在尝试解决 VS Code 中的一个问题,即 R 语言服务器无法加载,并产生以下错误消息:

R Language Server (8931) started
Error: package or namespace load failed for ‘tidyverse’:
 .onAttach failed in attachNamespace() for 'tidyverse', details:
  call: NULL
  error: package or namespace load failed for ‘stringr’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/lib/R/library/stringi/libs/stringi.so':
  libicui18n.so.73: cannot open shared object file: No such file or directory
Execution halted

R Language Server (8931) exited with exit code 1

以下答案表明问题可能出在

stringi
软件包上。长话短说,我最终删除了
stringi
软件包,并尝试重新安装它,导致出现与上面类似的错误消息:

$> install.packages("stringi")

Error: package or namespace load failed for ‘tidyverse’:
 .onAttach failed in attachNamespace() for 'tidyverse', details:
  call: NULL
  error: package or namespace load failed for ‘stringr’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 there is no package called ‘stringi’
Execution halted

The downloaded source packages are in
    ‘/tmp/Rtmpu5V2g7/downloaded_packages’
Warning message:
In install.packages("stringi") :
  installation of package ‘stringi’ had non-zero exit status

我可以使用一些帮助来理解错误消息以及如何解决问题。


更新:

我尝试安装不同的软件包:

install.packages("fortunes"

这会返回与上面类似的错误,缺少

stringi

然后我尝试删除

tidyverse
stringr
,然后再次安装
tidyverse
,这返回了以下错误消息:

> remove.packages("tidyverse")
> remove.packages("stringr")
> install.packages("tidyverse")

Error in library(tidyverse) : there is no package called ‘tidyverse’
Execution halted
r tidyverse stringi
1个回答
0
投票

来自此 answer 的信息表明问题在于 R 尝试加载

stringi
,然后在未正确安装时加载
tidyverse

使用

--vanilla
标志从终端运行 R,然后安装
tidyverse
解决了问题:

例如
$> sudo R --vanilla
> install.packages("tidyverse")
© www.soinside.com 2019 - 2024. All rights reserved.