MacOS Big Sur 操作系统,使用yarn安装时出现以下错误:
$ yarn install
/usr/local/Cellar/yarn/1.22.11/libexec/lib/cli.js:46104
let {
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/Cellar/yarn/1.22.11/libexec/bin/yarn.js:24:13)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
从网上查资料后发现,是node的版本与yarn的版本冲突
node -v // v4.4.1
yarn -v // 1.22.11
更新node之后
node -v // v16.7.0
从新运行yarn install 安装成功。