Rails新命令给出错误



我一直在绞尽脑汁想解决这些问题。每次我尝试使用rails new命令创建一个新的Rails应用程序时,我都会得到错误。相应的文件被创建,但我真的想摆脱这些错误。我正在使用MacOS Monterey,在更新之前一切都很好…

我试着更新ruby,重新安装rails,试图原始所有的宝石,但没有工作。最后,我使用chruby使用本指南安装ruby,然后安装rails,但我仍然得到这些错误。我想我可能有点疯了,想要解决这些问题太久了。下面是我得到的错误:

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>'

运行gem pristine ...没有做太多,错误仍然存在。任何帮助都是感激的!

我也遇到过同样的错误信息。

修复它的事情是确保ruby -v显示一个最新的ruby版本(我现在使用3.0.3),然后重新运行gem install rails -v 6.1.4.1。在那之后,我能够rails new xxxx

遇到与上述相同的问题。不知道发生了什么,但运行brew install ruby为我修复了这个问题,我能够创建一个Rails应用程序。

这是更新日志的一部分。

==> Installing ruby dependency: openssl@1.1
==> Pouring openssl@1.1--1.1.1l_1.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/openssl@1.1/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

有一种来自上面的东西固定它的感觉。如果有人对发生的事情有更多的专业知识,请发表评论!:)

我有完全相同的问题,完全相同的错误。唯一能解决这个问题的就是卸载所有的东西(ruby, package manager, rails, homebrew,(虽然不是x-code)),然后从头开始。

我或多或少地遵循了这里的指南:https://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/?utm_source=stackoverflow

Rails现在像一个魅力。

相关内容

最新更新