###### ######
### #### #### ###
## ### ### ##
## #### ##
## #### ##
## ## ## ##
## ### ### ##
## ######################## ##
###### ### ### ######
### ## ## ## ## ###
### ## ### #### ### ## ###
## #### ######## #### ##
## ### ########## ### ##
## #### ######## #### ##
### ## ### #### ### ## ###
### ## ## ## ## ###
###### ### ### ######
## ######################## ##
## ### ### ##
## ## ## ##
## #### ##
## #### ##
## ### ### ##
### #### #### ###
###### ######
Welcome to React Native!
Learn once, write anywhere
✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing Bundler
error Your Ruby version is 3.0.0, but your Gemfile specified 2.7.5
✖ 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.
I was trying to setup new project in react native as i have latest macOS ventura 13.0 and xcode(Version 14.0.1 (14A400)
follow: https://reactnative.dev/docs/environment-setup
and some other solution as well but didn't work.
please help
it seems there a conflict with your ruby version, you can downgrade to the ruby version specified on the error message. To do that follow the steps:
Download some Ruby version manager like rvm
\curl -sSL https://get.rvm.io | bash -s stable
Install the version of ruby 2.7.5
rvm install 2.7.5
try create your react-native project again!
Related
When I try to run “pod install" in the terminal, I get this same error for all my projects. Last time a complete brew update was performed.
robajz#Roberts-MacBook-Pro ios % pod install
[!] Invalid `Podfile` file:
[!] Invalid `RNGestureHandler.podspec` file: undefined method `exists?' for File:Class.
# from /Users/robajz/Projects/shop8-mobile-app/node_modules/react-native-gesture-handler/RNGestureHandler.podspec:5
# -------------------------------------------
#
> isUserApp = File.exists?(File.join(__dir__, "..", "..", "node_modules", "react-native", "package.json"))
# if isUserApp
# -------------------------------------------
.
# from /Users/robajz/Projects/shop8-mobile-app/ios/Podfile:10
# -------------------------------------------
# target 'Shop8App' do
> config = use_native_modules!
#
# -------------------------------------------
So after much pain, i found that if I added this line into the .podspec where the error was coming from
print RUBY_VERSION
It was printing out 3.2.0 which I believe has deprecated the "exists" method as mentioned in the error, but I was using a .ruby-version file and rbenv as suggested in the docs and ruby -v was printing out 2.7.5 as expected.
After hunting through my file system to find where this v3.2.0 could possibly be installed I tried downgrading cocoapods from 1.11.3 -> 1.11.2 and it instantly solved my issue and the print in the podspec was now printing 2.7.5
I've installed Ruby and Rails, and for the most part it's installed. However, when I try to create an app to see if all the installations work, the rails server won't run. It goes something like this:
I created a new rails app file, it's shown in my C: directory so that's a success
but the last line at the installation said this:
bundle install
The latest bundler is 2.3.10, but you are currently running 1.15.3.
To update, run `gem install bundler`
Fetching source index from https://rubygems.org/"
I tried the
gem install bundler
next, but I got this error message:
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)
also when I tried,
rails s
I got this result:
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
-d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
# Default: sqlite3
[--skip-yarn], [--no-skip-yarn] # Don't use Yarn for managing JavaScript dependencies
[--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
-G, [--skip-git], [--no-skip-git] # Skip .gitignore file
[--skip-keeps], [--no-skip-keeps] # Skip source control .keep files
-M, [--skip-action-mailer], [--no-skip-action-mailer] # Skip Action Mailer files
-O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record files
-P, [--skip-puma], [--no-skip-puma] # Skip Puma related files
-C, [--skip-action-cable], [--no-skip-action-cable] # Skip Action Cable files
-S, [--skip-sprockets], [--no-skip-sprockets] # Skip Sprockets files
[--skip-spring], [--no-skip-spring] # Don't install Spring application preloader
[--skip-listen], [--no-skip-listen] # Don't generate configuration that depends on the listen gem
[--skip-coffee], [--no-skip-coffee] # Don't use CoffeeScript
-J, [--skip-javascript], [--no-skip-javascript] # Skip JavaScript files
[--skip-turbolinks], [--no-skip-turbolinks] # Skip turbolinks gem
-T, [--skip-test], [--no-skip-test] # Skip test files
[--skip-system-test], [--no-skip-system-test] # Skip system test files
[--dev], [--no-dev] # Setup the application with Gemfile pointing to your Rails checkout
[--edge], [--no-edge] # Setup the application with Gemfile pointing to Rails repository
[--rc=RC] # Path to file containing extra configuration options for rails command
[--no-rc], [--no-no-rc] # Skip loading of extra configuration options from .railsrc file
[--api], [--no-api] # Preconfigure smaller stack for API only apps
-B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install
[--webpack=WEBPACK] # Preconfigure for app-like JavaScript with Webpack (options: react/vue/angular)
Runtime options:
-f, [--force] # Overwrite files that already exist
-p, [--pretend], [--no-pretend] # Run but do not make any changes
-q, [--quiet], [--no-quiet] # Suppress status output
-s, [--skip], [--no-skip] # Skip files that already exist
Rails options:
-h, [--help], [--no-help] # Show this help message and quit
-v, [--version], [--no-version] # Show Rails version number and quit
Description:
The 'rails new' command creates a new Rails application with a default
directory structure and configuration at the path you specify.
You can specify extra command-line arguments to be used every time
'rails new' runs in the .railsrc configuration file in your home directory.
Note that the arguments specified in the .railsrc file don't affect the
defaults values shown above in this help message.
Example:rails new ~/Code/Ruby/weblog
This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
I have tried to install bundler, update bundler, update system... none of that worked. I've also tried the cacert.pem file for certification (according to one of the tutorial articles I found), but it's still doesn't work.
I'm using Windows 10, ruby 2.3.3p222 and Rails 5.1.3. With this, do I need to reinstall Ruby and Rails? Is there something missing in my installation?
When I use heroku open my web app works fine but when I'm using rails s (localhost) I am running into this error:
ActiveRecord::AdapterNotSpecified database configuration does not specify adapter
Why is this?
This is my database.yml
# PostgreSQL. Versions 8.2 and up are supported.
#
# Install the pg driver:
# gem install pg
# On OS X with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On OS X with MacPorts:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem 'pg'
#
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
And this is my gemfile:
source 'https://rubygems.org'
gem 'pg'
gem 'bootstrap-sass', '~> 3.1.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :production do
gem 'rails_12factor', '0.0.2'
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
For you app to work locally you need to:
Install Postgresql on your machine
Create a database for your development needs (let's call it my_app_development)
Change your database.yml to:
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
development:
<<: *default
database: my_app_development
run rake db:migrate
You didn't show the command causing this query, but this could happen if you pass a string and not a symbol.
For example:
irb(main):001:0> ActiveRecord::Base.establish_connection("#{Rails.env}")
ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
But then if you use a symbol, it will work.
irb(main):001:0> ActiveRecord::Base.establish_connection("#{Rails.env}".to_sym)
=> #<ActiveRecord::ConnectionAdapters::ConnectionPool:0x007f2f484a32a0 #....
Your database.yml should look something like this:
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
username: my_username
password: my_password
development:
<<: *default
database: "development_database_name"
test:
<<: *default
database: "test_database_name"
production:
<<: *default
database: "production_database_name"
Edit development_database_name to your local database name.
Also edit my_username and my_password to your correct db username and password.
Delete tabs nothing more, ident perfect, such as:
# PostgreSQL. Versions 8.2 and up are supported.
#
# Install the pg driver:
# gem install pg
# On OS X with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On OS X with MacPorts:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem 'pg'
#
default: &default
adapter: postgresql
encoding: utf8
pool: 5
host: 192.168.0.121
username: postgres
password: passpostgres
development:
<<: *default
database: DBPOSTGRES
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: DBPOSTGRES
# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
# ever seen by anyone, they now have access to your database.
#
# Instead, provide the password as a unix environment variable when you boot
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full rundown on how to provide these environment variables in a
# production deployment.
#
# On Heroku and other platform providers, you may have a full connection URL
# available as an environment variable. For example:
#
# DATABASE_URL="postgres://myuser:mypass#localhost/somedatabase"
#
# You can use this database configuration with:
#
# production:
# url: <%= ENV['DATABASE_URL'] %>
#
production:
<<: *default
database: DBPOSTGRES
password: <%= ENV['passpostgres'] %>
In case you're trying to use activerecord without rails you may run into this problem with a database.yml with multiple environment setups. So you'll need to pass the environment key into the config setup like this:
DB_ENV ||= 'development'
connection_details = YAML::load(File.open('config/database.yml'))
ActiveRecord::Base.establish_connection(connection_details[DB_ENV])
Why are you using a yml node reference in your database.yml?
You should have something like this:
#config/database.yml
development:
adapter: mysql2
encoding: utf8
database: ****
pool: 5
username: ****
password: ****
host: ***.***.***.*** #-> only for third party db server
production:
adapter: postgresql
encoding: utf8
database: ****
pool: 5
username: ****
password: ****
host: ***.***.***.*** #-> only for third party db server
Update
Rails runs using a database. You have to connect to a db to make it work, and to do that you have to define the different connection details in database.yml
To define the right information, you need to appreciate that Rails operates in several environments - development & production being the two most used
To get Rails working in your local (development) environment, you need to define the correct db details. This means you need a database to connect to - which is typically done setting up a local mysql / pgsql server
Bottom line is you connect to a db using:
hostname
username
password
db name
You need to define these in your config/database.yml file
If you have a server running in your local environment, your database.yml file will look like this:
#config/database.yml
development:
adapter: mysql2
encoding: utf8
database: db_name
pool: 5
username: username
password: password
In my case the reason was in my Rakefile.
when I run rake db:migrate, I got this:
rake db:migrate
rake aborted!
ActiveRecord::AdapterNotSpecified: The `default_env` database is not configured for the `default_env` environment.
Available databases configurations are:
development
test
production
I've found this row in my Rakefile:
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])
and changed with default value:
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'] || 'postgres://localhost/db_name')
and now it works fine. Details you can find here
I am trying install devkit on windows 7 but getting below error while issuing command
ruby dk.rb install.
[INFO] Skipping existing gem override for 'C:/RailsInstaller/Ruby1.9.3'
[WARN] Skipping existing DevKit helper library for 'C:/RailsInstaller/Ruby1.9.3'
So i tried >ruby dk.rb install --force but now i am getting this error,
[WARN] Updating (with backup) existing gem override for 'C:/RailsInstaller/Ruby1
.9.3'
[WARN] Updating (with backup) DevKit helper library for 'C:/RailsInstaller/Ruby1
.9.3'
I have installed ruby using rails installer.
This is the content in my config.yml file,
# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
- C:\RailsInstaller\Ruby1.9.3
Is just a warning, ignore it, don't --force it, use Ruby and live long and prosper.
I'm attempting to create a Debian package for a simple utility I wrote with fpm and bundler but am having difficulties. Here's how I generate my .deb (I assume you've checked out sns and are in it's root):
$ bundle install
$ rake install
$ fpm -s gem -t deb --prefix /var/lib/gems/1.8/ pkg/sns-0.1.1.gem
Successfully installed sns-0.1.1
1 gem installed
md5sum: : No such file or directory
Created /home/blt/projects/com/carepilot/sns/rubygem-sns_0.1.1_all.deb
$ dpkg-deb -c rubygem-sns_0.1.1_all.deb | grep sns_hosts
-rwxr-xr-x root/root 762 2011-08-18 22:28 ./var/lib/gems/1.8/gems/sns-0.1.1/bin/sns_hosts
-rwxr-xr-x root/root 398 2011-08-18 22:28 ./var/lib/gems/1.8/bin/sns_hosts
Which is how it should be. Unfortunately
$ cat /var/lib/gems/1.8/bin/sns_hosts
#!/home/blt/.rbenv/versions/1.9.2-p290/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'sns' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end
gem 'sns', version
load Gem.bin_path('sns', 'sns_hosts', version)
The gem creates a shunt which incorrectly sets the ruby interpreter to that of my development environment; rather a problem when pushing to other computers. How might I influence the interpreter which is set in the shunt script?
gem install has -E parameter to rewrite the shebang line to use /usr/bin/env. So you need to edit fpm to do this while packaging the gem. /usr/lib/ruby/gems/1.8/gems/fpm-0.3.7/lib/fpm/source/gem.rb line 120 has the parameters, you can try to add it there.