英文:
error Gem::Ext::BuildError: ERROR: Failed to build gem native extension
问题
ismail@Ismails-MacBook-Pro desktop % npx react-native@latest init AwesomeProject
错误 Gem::Ext::BuildError: 构建 gem 本地扩展失败。
当前目录: /Users/ismail/Dropbox/My Mac (Muhammad’s MacBook Pro)/Desktop/AwesomeProject/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c
/Users/ismail/.rvm/rubies/ruby-2.7.5/bin/ruby -I
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0 -r
./siteconf20230524-7627-1owxb3s.rb extconf.rb
检查是否可以在 -lffi 中找到 ffi_prep_closure_loc()... 否
检查是否可以在 -llibffi 中找到 ffi_prep_closure_loc()... 否
检查是否可以在 -llibffi-8 中找到 ffi_prep_closure_loc()... 否
检查 -Wl,--exclude-libs,ALL 是否被接受为 LDFLAGS... 否
检查 -pthread 是否被接受为 LDFLAGS... 是
创建 extconf.h
创建 Makefile
当前目录: /Users/ismail/Dropbox/My Mac (Muhammad’s MacBook Pro)/Desktop/AwesomeProject/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c
make "DESTDIR=" clean
当前目录: /Users/ismail/Dropbox/My Mac (Muhammad’s MacBook Pro)/Desktop/AwesomeProject/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c
make "DESTDIR="
/bin/sh: -c: line 0: 意外的 EOF,正在查找匹配的 `"
/bin/sh: -c: line 1: 语法错误: 意外的文件结束
make: *** "/Users/ismail/Dropbox/My] Error 2"
make 失败,退出代码 2
Gem 文件将保留在 /Users/ismail/Dropbox/My Mac (Muhammad’s MacBook Pro)/Desktop/AwesomeProject/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5 以供检查。
日志记录到 /Users/ismail/Dropbox/My Mac (Muhammad’s MacBook Pro)/Desktop/AwesomeProject/vendor/bundle/ruby/2.7.0/extensions/x86_64-darwin-22/2.7.0/ffi-1.15.5/gem_make.out
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:99:in `run'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:51:in `block in make'
...
安装 Bundler 时出错
错误: 看起来你的 iOS 环境没有正确设置。请前往 https://reactnative.dev/docs/next/environment-setup 并按照 macOS 和 iOS 的 React Native CLI 快速入门指南进行操作。
错误: 看起来你的 iOS 环境没有正确设置。请前往 https://reactnative.dev/docs/next/environment-setup 并按照 macOS 和 iOS 的 React Native CLI 快速入门指南进行操作。
请使用 --verbose 标志运行 CLI 以获取更多详细信息。
我已尝试安装 cocopods gem、nodejs 和许多其他命令,甚至尝试了文档,但仍然出现错误。
英文:
ismail@Ismails-MacBook-Pro desktop % npx react-native@latest init AwesomeProject
###### ######
### #### #### ###
## ### ### ##
## #### ##
## #### ##
## ## ## ##
## ### ### ##
## ######################## ##
###### ### ### ######
### ## ## ## ## ###
### ## ### #### ### ## ###
## #### ######## #### ##
## ### ########## ### ##
## #### ######## #### ##
### ## ### #### ### ## ###
### ## ## ## ## ###
###### ### ### ######
## ######################## ##
## ### ### ##
## ## ## ##
## #### ##
## #### ##
## ### ### ##
### #### #### ###
###### ######
Welcome to React Native!
Learn once, write anywhere
✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing Bundler
error Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/ismail/Dropbox/My Mac (Muhammad’s MacBook
Pro)/Desktop/AwesomeProject/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c
/Users/ismail/.rvm/rubies/ruby-2.7.5/bin/ruby -I
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0 -r
./siteconf20230524-7627-1owxb3s.rb extconf.rb
checking for ffi_prep_closure_loc() in -lffi... no
checking for ffi_prep_closure_loc() in -llibffi... no
checking for ffi_prep_closure_loc() in -llibffi-8... no
checking for whether -Wl,--exclude-libs,ALL is accepted as LDFLAGS... no
checking for whether -pthread is accepted as LDFLAGS... yes
creating extconf.h
creating Makefile
current directory: /Users/ismail/Dropbox/My Mac (Muhammad’s MacBook
Pro)/Desktop/AwesomeProject/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c
make "DESTDIR=" clean
current directory: /Users/ismail/Dropbox/My Mac (Muhammad’s MacBook
Pro)/Desktop/AwesomeProject/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c
make "DESTDIR="
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** ["/Users/ismail/Dropbox/My] Error 2
make failed, exit code 2
Gem files will remain installed in /Users/ismail/Dropbox/My Mac (Muhammad’s
MacBook Pro)/Desktop/AwesomeProject/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5 for
inspection.
Results logged to /Users/ismail/Dropbox/My Mac (Muhammad’s MacBook
Pro)/Desktop/AwesomeProject/vendor/bundle/ruby/2.7.0/extensions/x86_64-darwin-22/2.7.0/ffi-1.15.5/gem_make.out
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:99:in
`run'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:51:in
`block in make'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:43:in
`each'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:43:in
`make'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/ext_conf_builder.rb:63:in
`block in build'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/tempfile.rb:291:in `open'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/ext_conf_builder.rb:30:in
`build'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:169:in
`block in build_extension'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:165:in
`synchronize'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:165:in
`build_extension'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:210:in
`block in build_extensions'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:207:in
`each'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/ext/builder.rb:207:in
`build_extensions'
/Users/ismail/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/rubygems/installer.rb:844:in
`build_extensions'
/Users/ismail/.rvm/gems/ruby-2.7.5/gems/bundler-2.4.13/lib/bundler/rubygems_gem_installer.rb:72:in
`build_extensions'
/Users/ismail/.rvm/gems/ruby-2.7.5/gems/bundler-2.4.13/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/Users/ismail/.rvm/gems/ruby-2.7.5/gems/bundler-2.4.13/lib/bundler/source/rubygems.rb:198:in
`install'
/Users/ismail/.rvm/gems/ruby-2.7.5/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:54:in
`install'
/Users/ismail/.rvm/gems/ruby-2.7.5/gems/bundler-2.4.13/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/Users/ismail/.rvm/gems/ruby-2.7.5/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:156:in
`do_install'
/Users/ismail/.rvm/gems/ruby-2.7.5/gems/bundler-2.4.13/lib/bundler/installer/parallel_installer.rb:147:in
`block in worker_pool'
/Users/ismail/.rvm/gems/ruby-2.7.5/gems/bundler-2.4.13/lib/bundler/worker.rb:62:in
`apply_func'
/Users/ismail/.rvm/gems/ruby-2.7.5/gems/bundler-2.4.13/lib/bundler/worker.rb:57:in
`block in process_queue'
/Users/ismail/.rvm/gems/ruby-2.7.5/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in
`loop'
/Users/ismail/.rvm/gems/ruby-2.7.5/gems/bundler-2.4.13/lib/bundler/worker.rb:54:in
`process_queue'
/Users/ismail/.rvm/gems/ruby-2.7.5/gems/bundler-2.4.13/lib/bundler/worker.rb:90:in
`block (2 levels) in create_threads'
An error occurred while installing ffi (1.15.5), and Bundler cannot continue.
In Gemfile:
cocoapods was resolved to 1.12.1, which depends on
cocoapods-core was resolved to 1.12.1, which depends on
typhoeus was resolved to 1.4.0, which depends on
ethon was resolved to 0.16.0, which depends on
ffi
✖ Installing Bundler
error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
Error: Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.
at createFromTemplate (/Users/ismail/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/commands/init/init.js:131:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.initialize [as func] (/Users/ismail/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/commands/init/init.js:184:3)
at async Command.handleAction (/Users/ismail/.npm/_npx/dea611a43221eddd/node_modules/@react-native-community/cli/build/index.js:106:9)
info Run CLI with --verbose flag for more details.
i have tried install cocopods gem nodejs and many more commands even i tried documentation but still error
答案1
得分: 0
以下命令修复了我的错误
brew install libffi
ln -s $(brew --cellar libffi)/*/include/ffi.h /usr/local/include/ffi.h
ln -s $(brew --cellar libffi)/*/include/ffitarget.h /usr/local/include/ffitarget.h
参考了这个帖子:ffi/ffi#814 (comment)
英文:
The following commands fixed my error
brew install libffi
ln -s $(brew --cellar libffi)/*/include/ffi.h /usr/local/include/ffi.h
ln -s $(brew --cellar libffi)/*/include/ffitarget.h /usr/local/include/ffitarget.h
referred to this thread: ffi/ffi#814 (comment)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论