RN环境搭建中的问题

==> Installing dependencies for ffmpeg: nasm, pkg-config, gettext, texi2html, lame, libogg, libvorbis, libvpx, opus, sdl2, snappy, theora, x264, x265, xvid and xz

==> Installing ffmpeg dependency: nasm

==> Downloading https://homebrew.bintray.com/bottles/na

Already downloaded: /Users/lidi/Library/Caches/Homebrew/downloads/aba39483dea4772cb4795d4f4b38ae52716d33772c969079ebcac1c11c80aebd–nasm-2.13.03.high_sierra.bottle.tar.gz

Error: No such file or directory @ dir_chdir - /usr/local/Cellar

Warning: Bottle installation failed: building from source.

==> Downloading https://www.nasm.us/pub/nasm/releasebui

Already downloaded: /Users/lidi/Library/Caches/Homebrew/downloads/28816079f19ed75d3c9db08761e9637cc93ff22bbd56b4d6d87697b60d4ca4a1–nasm-2.13.03.tar.xz

Error: An exception occurred within a child process:
Errno::EPERM: Operation not permitted @ dir_s_mkdir - /usr/local/Cellar

由于登陆用户不是HomeBrew的安装用户、所以报以上错误这里解决如下:
1.在当前用户重新安装HomeBrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2.在安装cocoapods的时候
出现ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
首先我们需要将gem换成我们国内的镜像
2.1 gem sources --remove https://rubygems.org/
2.2 gem source -a https://gems.ruby-china.com
2.3 gem source -l

*** CURRENT SOURCES ***

https://gems.ruby-china.com 

输入完2.3命令后可以看到终端出现上边的提示,证明已经将gem换成国内的镜像了。

2.4 在终端中输入sudo gem update –system这条命令,问题就解决了。
3. 如果出现curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused,不要惊慌,这个不是报错,是需要fq了。可以科学上网来解决。
4. 前几步都完成后如果还有报错

Error running 'requirements_osx_brew_libs_install autoconf automake libtool pkg-config coreutils libyaml libksba readline zlib openssl@1.1',
please read /Users/apple/.rvm/log/1590053915_ruby-2.4.9/package_install_autoconf_automake_libtool_pkg-config_coreutils_libyaml_libksba_readline_zlib_openssl@1.1.log
Requirements installation failed with status: 1.

这个就需要我们 用brew来安装automake和autoconf
4.1 brew install automake
4.2 brew install autoconf
4.3 如果在执行4.1或4.2是报一下这样的错误

Error: The following directories are not writable by your user: /usr/local/share/man/man8

说明我们的权限不够需要给到足够的权限
1.在终端中输入

sudo chown -R `whoami`:admin /usr/local/bin

接着系统会提醒你输入密码,输入密码回车之后接着输入:

sudo chown -R `whoami`:admin /usr/local/share

之后就能在终端中用brew install 安装文件了。

5.直接用sudo rvm install 2.4就可以安装ruby
5.1如果没有rvm,使用curl -L https://get.rvm.io | bash -s stable安装rvm(需要科学上网)
5.2 rvm -v 查看版本,完成之后Ruby、Ruby Gems就安装好了

6.ruby安装成功后就可以

gem install cocoapods

安装cocoapods库了。

安装完之后可以使用react-native init 《name》安装一个rn项目,在ios下打开终端pod install 就可以运行项目了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值