yarn 命令无法在带有 macbook 的节点 v18 上运行

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

我正在使用

nvm
node
版本之间切换。当我选择
node v16
时,
yarn
在我的 Macbook 上运行良好。但是当我使用 nvm 切换到
node v18
时,我收到此错误。

yarn install v1.22.19
info No lockfile found.
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/@react-native-async-storage%2fasync-storage: ETIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/Volumes/External/CodeScale/xdotenrich/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

甚至

sudo npm install --globle yarn --force
也不起作用!

 % sudo npm install --global yarn --force
npm WARN using --force Recommended protections disabled.
(⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂⠂) ⠦ idealTree:lib: sill idealTree buildDeps

有谁知道如何解决这个错误?

node.js yarnpkg yarn-lock.json
1个回答
0
投票

找到了一个快速修复方法,您可以在终端中运行这些命令!

在 macOS 终端上:

export NODE_OPTIONS=--openssl-legacy-provider

在 Windows 命令提示符下:

set NODE_OPTIONS=--openssl-legacy-provider

在 PowerShell 上:

$env:NODE_OPTIONS = "--openssl-legacy-provider"
© www.soinside.com 2019 - 2024. All rights reserved.