react Native搭建开发环境

请大家首先参考 react Native的中文官网http://reactnative.cn/docs/0.45/getting-started.html#content,我只是在搭建的时候出现一些问题

目标平台: iOS 开发平台: macOS

我的报错:
使用Homebrew来安装Node.js和Yarn的时候,一直报:
cannot find module 'update-notifier'

原因

我原来电脑已经安装了node,再使用Homebrew安装的时候一直报错。

解决方案:

删除node文件,完全卸载node和npm

sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}

通过brew安装node和npm

brew link node brew uninstall node brew install node

如果报错:

Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink include/node/android-ifaddrs.h Target /usr/local/include/node/android-ifaddrs.h already exists. You may want to remove it:   rm '/usr/local/include/node/android-ifaddrs.h'

或者警告

Warning: Unbrewed header files were found in /usr/local/include. If you didn't put them there on purpose they could cause problems when building Homebrew formulae, and may need to be deleted.

请按照以下方法执行

sudo brew uninstall node brew update brew upgrade brew cleanup brew install node sudo chown -R $(whoami) /usr/local brew link --overwrite node brew postinstall node

未完,待续。。。

相关内容推荐