Nim*_*ema 13 macos homebrew node.js expo
我刚刚开始接触 Expo 并尝试创建我的第一个项目。我通过安装的Node.js(v14.0.0)家酿,并安装安装expo-cli
使用npm
由作为世博会提到运行以下命令,快速入门指南:
# Install the command line tools
npm install --global expo-cli
# Create a new project
expo init my-project
Run Code Online (Sandbox Code Playgroud)
但是,我在运行如下expo init my-project
命令时收到一个错误:
错误:不再支持 Node.js 版本 14.0.0。
expo-cli 支持以下 Node.js 版本:
>=10.13.0 <11.0.0(活动 LTS)
>=12.0.0 <13.0.0(活动 LTS)
>=13.0.0 <14.0.0(当前版本)
我尝试运行expo
, expo-cli
, expo diagnostics
,并且每次都收到相同的错误消息。我几乎无法运行 expo
command。
我查看了 Node.js发行说明,结果发现 Node.js 最近已升级到 14.x 版。
熟悉 Expo 开发和发布时间表的人可以帮助了解以下两种推荐方法吗?
降级到较旧的稳定且支持 Expo 的 Node.js 版本。
等待 Expo 的更新(仅当 Expo 的更新即将发布时)。
我使用的是运行最新公开版 macOS Catalina 版本 10.15.4 (19E287) 的 Mac。
Flo*_*ues 11
最好的解决办法是降级到node
所支持的版本expo-cli
使用brew
。
只需运行以下命令:
brew unlink node
brew install ${MAX_ALT_NODE=$(brew search node | grep node@ | sort -rn | head -n 1)}
brew link --overwrite --force $MAX_ALT_NODE
Run Code Online (Sandbox Code Playgroud)
你完成了!expo-cli
重回正轨!
解释:
#unlink current node version so we can install another version
brew unlink node
#install the highest alternative node version available with `brew`
brew install ${MAX_ALT_NODE=$(brew search node | grep node@ | sort -rn | head -n 1)}
#force link this version to use it instead of default node version
brew link --overwrite --force $MAX_ALT_NODE
Run Code Online (Sandbox Code Playgroud)
笔记:
node
版本brew
,因此将来也可以使用。expo-cli
库中,因此应该很快可用。工作 @ 2020 年 5 月
$ brew uninstall node --ignore-dependencies node
$ brew install node@12
$ brew link --force --overwrite node@12
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7151 次 |
最近记录: |