Issues with setting up react native cli project - ruby

When I run npx react-native projectname, the project is only created partially.
Now when I run bundle install I get:
1. Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
2. An error occurred while installing ffi (1.15.5), and Bundler cannot continue. Make sure that "gem install ffi -v '1.15.5' --source 'https://rubygems.org/'" succeeds before bundling.
Using atomos 0.1.3
Using bundler 2.1.4
Using claide 1.1.0
Using fuzzy_match 2.0.4
Using nap 1.1.0
Using netrc 0.11.0
Fetching ffi 1.15.5
Installing ffi 1.15.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: █████████████████████s/React
Native/uber/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c
█████████████████████/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0 -r ./siteconf20221129-56735-3mfz1o.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: █████████████████████React
Native/uber/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c
make "DESTDIR=" clean
current directory: █████████████████████React
Native/uber/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: *** █████████████████████ Error 2
make failed, exit code 2
Gem files will remain installed in █████████████████████/React
Native/uber/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5 for inspection.
Results logged to █████████████████████/React
Native/uber/vendor/bundle/ruby/2.7.0/extensions/arm64-darwin-21/2.7.0/ffi-1.15.5/gem_make.out
An error occurred while installing ffi (1.15.5), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.15.5' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
cocoapods was resolved to 1.11.3, which depends on
cocoapods-core was resolved to 1.11.3, which depends on
typhoeus was resolved to 1.4.0, which depends on
ethon was resolved to 0.16.0, which depends on
ffi
Yes, I have installed the ffi 1.15.5 (below screenshot) but it is still saying I dont have it
█████████████████████ gem install ffi -v '1.15.5' --source 'https://rubygems.org/ '
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Parsing documentation for ffi-1.15.5
Done installing documentation for ffi after 0 seconds
1 gem installed
Ruby version: ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [arm64-darwin21]
pod --version: 1.11.3
I am impressed how difficult it is to start a project. Someone please help

Try using expo. https://docs.expo.dev/get-started/create-a-new-app/
run npx create-expo-app my-app
this will create a new app called "my-app".
Or you could run npx create-expo-app --template to begin with a starter app. I like to use 'Navigation (TypeScript)'.
The expo link will explain how to set up your app and how to run your app in a simulator or with the expo go app on your phone. It's a great resource.
Hope that helped!

Related

I have cloned a React Native Typescript project in Mac M1 which is not building in IOS, Showing An error occurred while installing ffi (1.15.5)

Recently I cloned a project from one of my colleague which is React Native project with TypeScript. The project works fine in Android but failing in while running pod install
I have attached the whole error along with the React Native version.
Fetching ffi 1.15.5
Installing ffi 1.15.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/dev/Desktop/Grap Projects/my-app/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c
/Users/dev/.rvm/rubies/ruby-2.7.5/bin/ruby -I /Users/dev/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0 -r ./siteconf20221205-14290-hsozy0.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/dev/Desktop/Grap Projects/rapp/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c
make "DESTDIR=" clean
current directory: /Users/dev/Desktop/Grap /-app/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/dev/Desktop/Gr] Error 2
make failed, exit code 2
Gem files will remain installed in /Users/dev/Desktop/Projects//vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5 for inspection.
Results logged to /Users/dev/Desktop/G Projects/-app/vendor/bundle/ruby/2.7.0/extensions/arm64-darwin-22/2.7.0/ffi-1.15.5/gem_make.out
An error occurred while installing ffi (1.15.5), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.15.5' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
cocoapods was resolved to 1.11.3, which depends on
cocoapods-core was resolved to 1.11.3, which depends on
typhoeus was resolved to 1.4.0, which depends on
ethon was resolved to 0.16.0, which depends on
ffi
➜ ios git:(dev)
I tried every possible way of resolving it but failed to do so. I even tried to create another project which works fine.
"react-native": "0.70.6",
ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [arm64-darwin22]
Gem File:
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '2.7.5'
gem 'cocoapods', '~> 1.11', '>= 1.11.2'

RN CLI error - Failed to build gem native extension, error occurred while installing ffi

When I run npx react-native projectname, the project is only created partially.
Now when I run bundle install I get:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
An error occurred while installing ffi (1.15.5), and Bundler cannot continue.
Make sure that "gem install ffi -v '1.15.5' --source 'https://rubygems.org/'" succeeds before bundling.
Using atomos 0.1.3
Using bundler 2.1.4
Using claide 1.1.0
Using fuzzy_match 2.0.4
Using nap 1.1.0
Using netrc 0.11.0
Fetching ffi 1.15.5
Installing ffi 1.15.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: █████████████████████s/React
Native/uber/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c
█████████████/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0 -r ./siteconf20221129-56735-3mfz1o.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: █████████████████████React
Native/uber/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/ext/ffi_c
make "DESTDIR=" clean
current directory: █████████████████████React
Native/uber/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: *** █████████████████████ Error 2
make failed, exit code 2
Gem files will remain installed in █████████████████████/React
Native/uber/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5 for inspection.
Results logged to █████████████████████/React
Native/uber/vendor/bundle/ruby/2.7.0/extensions/arm64-darwin-21/2.7.0/ffi-1.15.5/gem_make.out
An error occurred while installing ffi (1.15.5), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.15.5' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
cocoapods was resolved to 1.11.3, which depends on
cocoapods-core was resolved to 1.11.3, which depends on
typhoeus was resolved to 1.4.0, which depends on
ethon was resolved to 0.16.0, which depends on
ffi
Yes, I have installed the ffi 1.15.5 (below screenshot) but it is still saying I dont have it
█████████████████████ gem install ffi -v '1.15.5' --source 'https://rubygems.org/ '
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Parsing documentation for ffi-1.15.5
Done installing documentation for ffi after 0 seconds
1 gem installed
Ruby version: ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [arm64-darwin21]
pod --version: 1.11.3
I am impressed how difficult it is to start a project. Someone please help
I've been stuck with this problem for an hour. The fix would be initializing your project on a folder directory without space.
Try running npx react-native init on Desktop and it should work fine.

Cannot install Jekyll after updating to Catalina - An error occurred while installing ffi (1.9.18)

I have updated my mac to use Catalina and now I am having all sorts of issues when I try and install Jekyll.
This is what I get when I run my usual grunt setup:
Running "jekyll:dist" (jekyll) task
>> Error: Command failed: bundle exec jekyll -v
>> bundler: command not found: jekyll
>> Install missing gem executables with `bundle install`
Warning: Please install Jekyll before running this task. Use --force to continue.
I then run sudo bundle install
I then get this:
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
application for all non-root users on this machine.
Fetching gem metadata from https://rubygems.org/.........
Using public_suffix 3.0.1
Using addressable 2.5.2
Using bundler 2.1.4
Using colorator 1.1.0
Fetching ffi 1.9.18
Installing ffi 1.9.18 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/gems/ffi-1.9.18/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20201016-30905-1yh2cx1.rb extconf.rb
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
checking for shlwapi.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... yes
creating extconf.h
creating Makefile
current directory: /Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/gems/ffi-1.9.18/ext/ffi_c
make "DESTDIR=" clean
current directory: /Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/gems/ffi-1.9.18/ext/ffi_c
make "DESTDIR="
compiling AbstractMemory.c
compiling ArrayType.c
compiling Buffer.c
compiling Call.c
Call.c:355:5: error: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
rbffi_thread_blocking_region(call_blocking_function, data, (void *) -1, NULL);
^
./Thread.h:78:39: note: expanded from macro 'rbffi_thread_blocking_region'
# define rbffi_thread_blocking_region rb_thread_call_without_gvl
^
1 error generated.
make: *** [Call.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/gems/ffi-1.9.18 for inspection.
Results logged to
/Applications/MAMP/htdocs/hangr/vendor/bundle/ruby/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.9.18/gem_make.out
An error occurred while installing ffi (1.9.18), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.18' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
jekyll was resolved to 3.4.3, which depends on
jekyll-sass-converter was resolved to 1.5.1, which depends on
sass was resolved to 3.5.5, which depends on
sass-listen was resolved to 4.0.0, which depends on
rb-inotify was resolved to 0.9.10, which depends on
ffi
When I run
ruby -v
I get
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
I have no idea at all what I need to do.
When I run
jekyll -v
I get
-bash: /usr/local/bin/jekyll: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory
I tried running this from another post but had no luck
gem install ffi -v '1.9.18' -- --with-cflags="-Wno-error=implicit-function-declaration"
Does anyone have any ideas?
Thanks
The root problem is that you cannot install one of jekyl's dependancies - specifically the ffi gem. Knowing that will better help you workout a fix.
You can see that this is the error by reading your bundle output. Learn how to read these so you can better help yourself in the future; If you were searching for "install ffi on macOS" you might have found more information available to you.
Give that you've just installed Catalina, it's likely that GCC isn't on your machine, or is outdated, or is unlinked.
Try running xcode-select --install to (re)install the Xcode command line tools.
ALSO - STOP USING SUDO
At the very top of your bundle output is a warning that you shouldn't use sudo when installing gems. It's good advice to follow!
Even better advice would be to use rbenv or rvm to create gem sets or environments for each ruby application you're working with. But, if you don't go all the way down that path, ** at least, stop using sudo**

jekyll build error unknown encoding name "chunked\r\n\r\n25"

I am trying something simple. Using Jekyll with Bundler. The first thing to do is create a new directory for your project and run  bundle init. This creates a new Bundler project (by creating an empty Gemfile).
mkdir my-jekyll-website
cd my-jekyll-website
bundle init
bundle config set --local path 'vendor/bundle'
bundle add jekyll
The last command gives me an issue.
C:\Users\***\Documents\LEARNING\web stuff\Jekyll\my-jekyll-website>bundle add jekyll
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Fetching public_suffix 4.0.6
Installing public_suffix 4.0.6
Fetching addressable 2.7.0
Installing addressable 2.7.0
Using bundler 2.1.4
Fetching colorator 1.1.0
Installing colorator 1.1.0
Fetching concurrent-ruby 1.1.7
Installing concurrent-ruby 1.1.7
Fetching eventmachine 1.2.7 (x64-mingw32)
Installing eventmachine 1.2.7 (x64-mingw32)
Fetching http_parser.rb 0.6.0
Installing http_parser.rb 0.6.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: C:/Users/****/Documents/LEARNING/web
stuff/Jekyll/my-jekyll-website/vendor/bundle/ruby/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
C:/Ruby26-x64/bin/ruby.exe -I C:/Ruby26-x64/lib/ruby/2.6.0 -r
./siteconf20200925-7100-x9bvnr.rb extconf.rb
creating Makefile
current directory: C:/Users/***/Documents/LEARNING/web
stuff/Jekyll/my-jekyll-website/vendor/bundle/ruby/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR=" clean
current directory: C:/Users/***/Documents/LEARNING/web
stuff/Jekyll/my-jekyll-website/vendor/bundle/ruby/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser
make "DESTDIR="
generating ruby_http_parser-x64-mingw32.def
compiling ruby_http_parser.c
x86_64-w64-mingw32-gcc.exe: error:
stuff/Jekyll/my-jekyll-website/vendor/bundle/ruby/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser:
No such file or directory
make: *** [Makefile:244: ruby_http_parser.o] Error 1
make failed, exit code 2
Gem files will remain installed in C:/Users/***/Documents/LEARNING/web
stuff/Jekyll/my-jekyll-website/vendor/bundle/ruby/2.6.0/gems/http_parser.rb-0.6.0
for inspection.
Results logged to C:/Users/***/Documents/LEARNING/web
stuff/Jekyll/my-jekyll-website/vendor/bundle/ruby/2.6.0/extensions/x64-mingw32/2.6.0/http_parser.rb-0.6.0/gem_make.out
An error occurred while installing http_parser.rb (0.6.0), and Bundler cannot
continue.
Make sure that `gem install http_parser.rb -v '0.6.0' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
jekyll was resolved to 4.1.1, which depends on
em-websocket was resolved to 0.5.2, which depends on
http_parser.rb
What am I missing? Why is this happening?
When I run,
gem install http_parser.rb -v '0.6.0' --source 'https://rubygems.org/'
I get the following output,
http://rubygems.org' Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed http_parser.rb-0.6.0
Parsing documentation for http_parser.rb-0.6.0 unknown encoding name "chunked\r\n\r\n25" for ext/ruby_http_parser/vendor/http-parser-java/tools/parse_tests.rb,
skipping
Done installing documentation for http_parser.rb after 1 seconds
1 gem installed
Any pointers that will help me out of this?
I am running this on a Windows 10 laptop.
The code editor is VS Code and the Jekyll version is 4.1.1.
I just had the same problem on windows 10. In my case, the issue seemed to be caused by my Windows path including a folder with a space in its name and I see that you were in the same position ("web stuff"). Note the wording of the error - it only includes the section of the path following the space. In my case, moving the installation to a different folder without a space in the name fixed the problem.
compiling ruby_http_parser.c
x86_64-w64-mingw32-gcc.exe: error:
stuff/Jekyll/my-jekyll-website/vendor/bundle/ruby/2.6.0/gems/http_parser.rb-0.6.0/ext/ruby_http_parser:
No such file or directory
make: *** [Makefile:244: ruby_http_parser.o] Error 1
make failed, exit code 2
I guess that the compilation stage has failed to quote the name of the file to compile. I'm not a Ruby or Jekyll developer and don't know where to log that issue.

Error installing RedCloth (4.2.9) on OS X 10.9.2

I try to install Jekyll with pages, using enter link description here.
The process stops when installing RedCloth (4.2.9): "Make sure that gem install RedCloth -v '4.2.9' succeeds before bundling."
The results below (I changed https in H due to url limitations in this Question).
I run OS X 10.9.2
Step 1 = OK
mikea:mego mikea$ ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
Step 2 = OK
mikea:mego mikea$ sudo gem install bundler
Password:
Successfully installed bundler-1.5.3
Parsing documentation for bundler-1.5.3
1 gem installed
Step 3 = NOK
mikea:mego mikea$ bundle install
Fetching gem metadata from H://rubygems.org/.......
Fetching additional metadata from h://rubygems.org/..
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-cflags=-w
checking for main() in -lc... yes
creating Makefile
make "DESTDIR="
compiling redcloth_attributes.c
compiling redcloth_inline.c
compiling redcloth_scan.c
linking shared-object redcloth_scan.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [redcloth_scan.bundle] Error 1
Gem files will remain installed in /Users/mikea/.bundler/tmp/25125/gems/RedCloth-4.2.9 for inspection.
Results logged to /Users/mikea/.bundler/tmp/25125/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out
An error occurred while installing RedCloth (4.2.9), and Bundler cannot
continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
I solved this by install rbenv with brew, and then install ruby 2.1.1 through rbenv. Finally change the ruby version to 2.1.1. Here is the command:
$brew update
$brew install rbenv
$rbenv install 2.1.1
$rbenv global 2.1.1
log out. Now you can try your 3 step.
I did not use hue answer to install rbenv with brew. Maybe you can use it.
I solved the problem by using Terminal, first go to the folder in Sites and then type:
jekyll serve --watch --baseurl ""

Resources