我正在尝试安装 React Native 的环境。 我按照网站的说明进行操作,直到进入cmd
create-react-native-app AwesomeProject
过了一会儿,我收到一条绿色的大消息:
You are currently running Node v0.12.2.
React Native runs on Node 4.0 or newer. There are several ways to
upgrade Node.js depending on your preference.
nvm: nvm install node && nvm alias default node
Homebrew: brew unlink iojs; brew install node
Installer: download the Mac .pkg from https://nodejs.org/
About Node.js: https://nodejs.org
Follow along at: https://github.com/facebook/react-native/issues/2545
我尝试升级我的nodejs,但我从网站上获得了最新版本。 为什么它仍然抛出这个错误?
最佳答案
嗨,user24136,我自己构建了 React Native 应用程序,并且正在运行最新的 Node 版本。错误表明您安装的 Node.js 是旧的,而 React Native 确实在 Node 4.0+ 上运行。好像您在 Mac 上,请访问此链接 Node.js并使用安装程序将 NPM 和 Node 升级到最新版本。成功安装后,运行命令 node -v
和 npm -v
,您应该分别看到较新的版本 v6.10.3
和 3.10.10
。然后运行命令 react-native init AwesomeProject
并检查它是否有效。
关于node.js - React Native Node安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43962468/