登录 主页

yarn安装bootstrap react-bootstrap 报错:error An unexpected error occurred: "https://registry.npm.taobao.org/bootstrap: certificate has expired".

2024-06-03 02:31PM

使用yarn在安装bootstrap和react-bootstrap时报错说:

meiyi@meiyi-Extensa-2511G:~/workspace/dongtaipaifang_2_frontend$ yarn add bootstrap react-bootstrap
yarn add v1.22.19
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.npm.taobao.org/bootstrap: certificate has expired".
info If you think this is a bug, please open a bug report with the information provided in "/home/meiyi/workspace/dongtaipaifang_2_frontend/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
meiyi@meiyi-Extensa-2511G:~/workspace/dongtaipaifang_2_frontend$ yarn config set registry https://registry.npmjs.org/

是因为访问淘宝的 npm 镜像时,证书已过期。 

解决方法:

1.修改你的 yarn 配置文件,切换到官方的 npm 源

yarn config set registry https://registry.npmjs.org/

 2.然后再尝试安装 bootstrapreact-bootstrap

yarn add bootstrap react-bootstrap

我这里使用这个方法并没有解决掉,我使用了强制设置 registry,可以通过在安装命令中强制设置 registry 试一下:

$ yarn add bootstrap react-bootstrap --registry https://registry.npmjs.org/
yarn add v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
dependencies...
warning "@craco/craco > cosmiconfig-typescript-loader@1.0.9" has unmet peer dependency "@types/node@*".
warning "@craco/craco > cosmiconfig-typescript-loader@1.0.9" has unmet peer dependency "typescript@>=3".
warning "@craco/craco > cosmiconfig-typescript-loader > ts-node@10.9.1" has unmet peer dependency "@types/node@*".
warning "@craco/craco > cosmiconfig-typescript-loader > ts-node@10.9.1" has unmet peer dependency "typescript@>=2.7".
warning " > @testing-library/user-event@12.8.3" has unmet peer dependency "@testing-library/dom@>=7.21.4".
warning "@typescript-eslint/eslint-plugin > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning " > less-loader@5.0.0" has incorrect peer dependency "less@^2.3.1 || ^3.0.0".
warning " > react-editable-table@1.12.32" has incorrect peer dependency "react@^0.12.2".
warning " > bootstrap@5.3.3" has unmet peer dependency "@popperjs/core@^2.11.8".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 12 new dependencies.
info Direct dependencies
├─ bootstrap@5.3.3
└─ react-bootstrap@2.10.2
info All dependencies
├─ @popperjs/core@2.11.8
├─ @react-aria/ssr@3.9.4
├─ @restart/ui@1.6.9
├─ @swc/helpers@0.5.11
├─ @types/react-transition-group@4.4.10
├─ @types/warning@3.0.3
├─ bootstrap@5.3.3
├─ prop-types-extra@1.1.1
├─ react-bootstrap@2.10.2
├─ react-lifecycles-compat@3.0.4
├─ uncontrollable@7.2.1
└─ warning@4.0.3
Done in 89.36s.

然后就成功安装上了。 

返回>>

登录

请登录后再发表评论。

评论列表:

目前还没有人发表评论