cancel
Showing results for 
Search instead for 
Did you mean: 

Project building is failing with ruby -e "require 'xcodeproj';

former_member807317
Discoverer
0 Kudos

While building the project we are getting the below error. Can you please help with this.

Command failed: ruby -e "require 'xcodeproj'; Xcodeproj::Config.new('/Users/garvitsingh/SAM Dev/platforms/ios/plugins-debug.xcconfig').merge(Xcodeproj::Config.new('/Users/garvitsingh/SAM Dev/node_modules/@nativescript-rtl/ui/platforms/ios/build.xcconfig')).save_as(Pathname.new('/Users/garvitsingh/SAM Dev/platforms/ios/plugins-debug.xcconfig'))"

/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require': cannot load such file -- xcodeproj (LoadError)

from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require'

from -e:1:in `<main>'

Error: Failed to run tns prepare ios

Accepted Solutions (1)

Accepted Solutions (1)

former_member807317
Discoverer
0 Kudos

I was able to resolved this with below step:
Install ruby in case it is missing

brew install ruby
add ruby to the path run
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> /Users/user_name/.bash_profile
for compiler:
 export LDFLAGS="-L/usr/local/opt/ruby/lib"
 export CPPFLAGS="-I/usr/local/opt/ruby/include"
Follow the instructions to set PATH. Replace user_name with your PC username:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> /Users/user_name/.bash_profile
echo 'export LDFLAGS="-L/usr/local/opt/ruby/lib"' >> ~/.bash_profile
echo 'export CPPFLAGS="-I/usr/local/opt/ruby/include"' >> ~/.bash_profile

source ~/.bash_profile
Check your path:
ruby -v
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.x86_64-darwin21]
% which ruby
/usr/local/opt/ruby/bin/ruby
reinstall cocoapods or xcodeproj
sudo gem install cocoapods -v {version no.}
sudo gem install xcodeproj

Answers (0)