Rares
Rares

Reputation: 51

Rails new command giving errors

I've been racking my brains trying to solve these issues. Every time I try to create a new Rails app using the rails new command, I get errors. The corresponding files are created, but I really want to get rid of these errors. I'm using MacOS Monterey, and before updating it everything went fine...

I tried updating ruby, reinstalled rails, tried to pristine all gems, but nothing worked. In the end, I used this guide to install ruby using chruby, and then installed rails, but I still get these errors. I think I might be going a bit crazy, been trying to solve these issues for too long. Here are the errors that I get:

Ignoring racc-1.6.0 because its extensions are not built. Try: gem pristine racc --version 1.6.0
Ignoring nio4r-2.5.8 because its extensions are not built. Try: gem pristine nio4r --version 2.5.8
Ignoring websocket-driver-0.7.5 because its extensions are not built. Try: gem pristine websocket-driver --version 0.7.5
      create  
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  .gitignore
      create  .gitattributes
      create  Gemfile
         run  git init from "."
Initialized empty Git repository in /Users/rares/Desktop/RoR/app/.git/
      create  package.json
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/javascript/channels/consumer.js
      create  app/javascript/channels/index.js
      create  app/javascript/packs/application.js
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images
      create  app/assets/images/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  bin/spring
      create  bin/yarn
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/cable.yml
      create  config/puma.rb
      create  config/spring.rb
      create  config/storage.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/application_controller_renderer.rb
      create  config/initializers/assets.rb
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/content_security_policy.rb
      create  config/initializers/cookies_serializer.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_framework_defaults_6_1.rb
      create  config/initializers/permissions_policy.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/master.key
      append  .gitignore
/Users/rares/.gem/ruby/2.7.2/gems/activesupport-6.1.4.1/lib/active_support/message_encryptor.rb:170:in `auth_data=': couldn't set additional authenticated data (OpenSSL::Cipher::CipherError)
    from /Users/rares/.gem/ruby/2.7.2/gems/activesupport-6.1.4.1/lib/active_support/message_encryptor.rb:170:in `_encrypt'
    from /Users/rares/.gem/ruby/2.7.2/gems/activesupport-6.1.4.1/lib/active_support/message_encryptor.rb:148:in `encrypt_and_sign'
    from /Users/rares/.gem/ruby/2.7.2/gems/activesupport-6.1.4.1/lib/active_support/encrypted_file.rb:88:in `encrypt'
    from /Users/rares/.gem/ruby/2.7.2/gems/activesupport-6.1.4.1/lib/active_support/encrypted_file.rb:61:in `write'
    from /Users/rares/.gem/ruby/2.7.2/gems/activesupport-6.1.4.1/lib/active_support/encrypted_configuration.rb:29:in `write'
    from /Users/rares/.gem/ruby/2.7.2/gems/railties-6.1.4.1/lib/rails/generators/rails/credentials/credentials_generator.rb:30:in `add_credentials_file_silently'
    from /Users/rares/.gem/ruby/2.7.2/gems/railties-6.1.4.1/lib/rails/generators/rails/app/app_generator.rb:194:in `credentials'
    from /Users/rares/.gem/ruby/2.7.2/gems/railties-6.1.4.1/lib/rails/generators/app_base.rb:165:in `public_send'
    from /Users/rares/.gem/ruby/2.7.2/gems/railties-6.1.4.1/lib/rails/generators/app_base.rb:165:in `build'
    from /Users/rares/.gem/ruby/2.7.2/gems/railties-6.1.4.1/lib/rails/generators/rails/app/app_generator.rb:386:in `create_credentials'
    from /Users/rares/.gem/ruby/2.7.2/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
    from /Users/rares/.gem/ruby/2.7.2/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
    from /Users/rares/.gem/ruby/2.7.2/gems/thor-1.1.0/lib/thor/invocation.rb:134:in `block in invoke_all'
    from /Users/rares/.gem/ruby/2.7.2/gems/thor-1.1.0/lib/thor/invocation.rb:134:in `each'
    from /Users/rares/.gem/ruby/2.7.2/gems/thor-1.1.0/lib/thor/invocation.rb:134:in `map'
    from /Users/rares/.gem/ruby/2.7.2/gems/thor-1.1.0/lib/thor/invocation.rb:134:in `invoke_all'
    from /Users/rares/.gem/ruby/2.7.2/gems/thor-1.1.0/lib/thor/group.rb:232:in `dispatch'
    from /Users/rares/.gem/ruby/2.7.2/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'
    from /Users/rares/.gem/ruby/2.7.2/gems/railties-6.1.4.1/lib/rails/commands/application/application_command.rb:26:in `perform'
    from /Users/rares/.gem/ruby/2.7.2/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
    from /Users/rares/.gem/ruby/2.7.2/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
    from /Users/rares/.gem/ruby/2.7.2/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
    from /Users/rares/.gem/ruby/2.7.2/gems/railties-6.1.4.1/lib/rails/command/base.rb:69:in `perform'
    from /Users/rares/.gem/ruby/2.7.2/gems/railties-6.1.4.1/lib/rails/command.rb:48:in `invoke'
    from /Users/rares/.gem/ruby/2.7.2/gems/railties-6.1.4.1/lib/rails/cli.rb:18:in `<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/rares/.gem/ruby/2.7.2/gems/railties-6.1.4.1/exe/rails:10:in `<top (required)>'
    from /usr/local/bin/rails:23:in `load'
    from /usr/local/bin/rails:23:in `<main>'

Running gem pristine ... doesn't do much, the errors are still there. Any help is appreciated!

Upvotes: 5

Views: 2521

Answers (3)

jtlim
jtlim

Reputation: 4339

This occurred for me with the exact same error message too.

The thing that fixed it was ensuring that ruby -v displayed a more recent ruby version (I'm using 3.0.3 now), and then re-running gem install rails -v 6.1.4.1. After that, I was able to rails new xxxx

Upvotes: 4

anna_p212
anna_p212

Reputation: 1

I had the exact same problem, exact same errors. The only thing that fixed it was to uninstall everything (ruby, package manager, rails, homebrew, (tho not x-code)) and start from scratch.

I more-or-less followed the guide here: https://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/?utm_source=stackoverflow

Rails now works like a charm.

Upvotes: -1

Mara
Mara

Reputation: 41

Had the same problem as described above. Not sure what happens but running brew install ruby fixed the issue for me and I was able to create a Rails app.

That is the part of the update log.

==> Installing ruby dependency: [email protected]
==> Pouring [email protected]_1.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/[email protected]/1.1.1l_1: 8,073 files, 18.5MB
==> Installing ruby
==> Pouring ruby--3.0.2_1.monterey.bottle.tar.gz
==> Caveats
By default, binaries installed by gem will be placed into:/usr/local/lib/ruby/gems/3.0.0/bin

Have a feeling that something from above fixed it. If anyone has more expertise on what has happened, please comment! :)

Upvotes: 0

Related Questions