react Native搭建开发环境

来源:互联网 发布:apache nginx 比较 编辑:程序博客网 时间:2024/05/17 11:07

请大家首先参考 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 nodebrew uninstall nodebrew install node

如果报错:

Error: The `brew link` step did not complete successfullyThe formula built, but is not symlinked into /usr/localCould not symlink include/node/android-ifaddrs.hTarget /usr/local/include/node/android-ifaddrs.halready 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 whenbuilding Homebrew formulae, and may need to be deleted.

请按照以下方法执行

sudo brew uninstall nodebrew updatebrew upgradebrew cleanupbrew install nodesudo chown -R $(whoami) /usr/localbrew link --overwrite nodebrew postinstall node

未完,待续。。。

原创粉丝点击