brew安装特定版本flow,解决问题!

在atom+react-native项目中安装了nuclide。然而使用flow的时候出现了问题。

$ brew -v
Homebrew 1.2.0

$ flow version
Flow, a static type checker for JavaScript, version 0.45.0

$ flow
Launching Flow server for /Users/real/Desktop/reactPro/pro2
Wrong version of Flow. The config specifies version ^0.42.0 but this is version 0.45.0

在我的.flowconfig文件中最后的地方也可以看到:

[version]
^0.42.0

这意味着flow的版本应该是>=0.42.0 <0.43.0,所以0.45.0是不合适的。这就需要下载0.42.0的版本。

搜索了网上一些说法(brew 安装特定版本):

  • brew install flow(安装的是最新版本)
  • brew versions (已经废弃了)
  • brew tap homebrew/versions(已经废弃了)
Warning: homebrew/versions was deprecated. This tap is now empty as all its formulae were migrated.

在我安装flow的过程中有这样的提示:

$ brew install flow
==> Downloading https://homebrew.bintray.com/bottles/flow-0.45.0.sierra.bottle.tar.gz
Already downloaded: /Users/real/Library/Caches/Homebrew/flow-0.45.0.sierra.bottle.tar.gz
==> Pouring flow-0.45.0.sierra.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
��  /usr/local/Cellar/flow/0.45.0: 8 files, 6.4MB

它下载的是0.45.0的版本,而我需要的是0.42.0的版本,于是我手动下载了。

https://homebrew.bintray.com/bottles/flow-0.42.0.sierra.bottle.tar.gz

然后将解压后的文件放到

/usr/local/Cellar/flow/

这样就安装了0.42.0的版本。然后通过

$ brew switch flow 0.42.0

就可以了。。一番心酸。。老哥们赞一赞。。

你可能感兴趣的:(React-RN)