Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于 yarn 的更新 #45

Open
QC-L opened this issue Mar 31, 2020 · 0 comments
Open

关于 yarn 的更新 #45

QC-L opened this issue Mar 31, 2020 · 0 comments

Comments

@QC-L
Copy link
Owner

QC-L commented Mar 31, 2020

官方给出的建议是,不使用 yarn/npm 管理 yarn,因此采用的是 brew 的管理方式。(stackoverflow 的讨论

方式一:

更新 yarn,先移除 yarn,重新下载

brew remove yarn
brew install yarn --ignore-dependencies

按如上操作,会出现以下警告⚠️

Warning: --ignore-dependencies is an unsupported Homebrew developer flag!
Adjust your PATH to put any preferred versions of applications earlier in the
PATH rather than using this unsupported flag!

并且会报出如下错误❌:

Error: An exception occurred within a child process:
  RuntimeError: /usr/local/opt/node not present or broken
Please reinstall node. Sorry :(

其原因是,找不到 yarn 的依赖项(node)。
我们需要给对应的文件夹创建一个 node 的软链:

mkdir /usr/local/opt/node
ln -s ~/.nvm/versions/node/v12.16.1/bin/node /usr/local/opt/node 

再重新执行 install 即可:

brew install yarn

然后就是开心的✅:

==> Downloading https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/49970642/487f6380-61e3-11ea-8294-0d743f488e
######################################################################## 100.0%
🍺  /usr/local/Cellar/yarn/1.22.4: 14 files, 5MB, built in 15 seconds

方式二:

brew upgrade yarn

参考资料:

yarnpkg/website#913
https://classic.yarnpkg.com/en/docs/usage
yarnpkg/yarn#7306

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant