rails new 创建 Rails 7.1-alpha 而不是 Rails 7.0

rails new creates Rails 7.1-alpha instead of Rails 7.0

我只是想知道。我想创建一个新的 rails 应用程序并在我的 linux 系统上进行以下设置:

gem install bundler -v 2.2.33
gem install rails -v 7.0.0

如果我通过

创建新应用
 rails new my_app -T --database=postgresql --javascript=webpack --css=bootstrap

Rails 7.1.0.alpha被用来代替Rails 7.0

在创建的 Gemfile 中列出了以下版本:

# Use main development branch of Rails
gem "rails", github: "rails/rails", branch: "main"
$ rails new my_app -T -G --database=postgresql --javascript=webpack --css=bootstrap
      create  
      create  Gemfile
         run  bundle install
Fetching https://github.com/rails/rails.git
Resolving dependencies...Fetching gem metadata from https://rubygems.org/.......
..........
Using rake 13.0.6
Using concurrent-ruby 1.1.9
Using minitest 5.15.0
Using marcel 1.0.2
Using mini_mime 1.1.2
Using bundler 2.2.33
Using crass 1.0.6
Using websocket-extensions 0.1.5
Using rack 2.2.3
Using nio4r 2.5.8
Using i18n 1.8.11
Using erubi 1.10.0
Using racc 1.6.0
Using method_source 1.0.0
Using thor 1.1.0
Using zeitwerk 2.5.2
Using builder 3.2.4
Using tzinfo 2.0.4
Using mail 2.7.1
Using activesupport 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using rack-test 1.1.0
Using nokogiri 1.12.5 (x86_64-linux)
Using websocket-driver 0.7.5
Using loofah 2.13.0
Using rails-html-sanitizer 1.4.2
Using rails-dom-testing 2.0.3
Using globalid 1.0.0
Using activemodel 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using actionview 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using activejob 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using activerecord 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using actionpack 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using actioncable 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using activestorage 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using actionmailer 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using railties 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using actionmailbox 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using actiontext 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using rails 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Bundle complete! 1 Gemfile dependency, 39 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle exec rails new /home/micklich/noscan/FA-Zunft/DIAAS/diaas_fa_rails7/my_app -T -G --database\=postgresql --main --javascript\=webpack --css\=bootstrap
       exist  
      remove  Gemfile
      remove  Gemfile.lock
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  Gemfile
      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/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  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/cable.yml
      create  config/puma.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/assets.rb
      create  config/initializers/content_security_policy.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/new_framework_defaults_7_1.rb
      create  config/initializers/permissions_policy.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/master.key
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/apple-touch-icon-precomposed.png
      create  public/apple-touch-icon.png
      create  public/favicon.ico
      create  public/robots.txt
      create  tmp
      create  tmp/.keep
      create  tmp/pids
      create  tmp/pids/.keep
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor
      create  vendor/.keep
      create  storage
      create  storage/.keep
      create  tmp/storage
      create  tmp/storage/.keep
      remove  config/initializers/cors.rb
      remove  config/initializers/new_framework_defaults_7_1.rb
         run  bundle install
Fetching https://github.com/rails/rails.git
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using rake 13.0.6
Using concurrent-ruby 1.1.9
Using minitest 5.15.0
Using builder 3.2.4
Using mini_mime 1.1.2
Using bindex 0.8.1
Using msgpack 1.4.2
Using bundler 2.2.33
Using erubi 1.10.0
Using crass 1.0.6
Using websocket-extensions 0.1.5
Using marcel 1.0.2
Using racc 1.6.0
Using rack 2.2.3
Using nio4r 2.5.8
Using method_source 1.0.0
Using thor 1.1.0
Using zeitwerk 2.5.2
Using websocket-driver 0.7.5
Using pg 1.2.3
Using i18n 1.8.11
Using tzinfo 2.0.4
Using mail 2.7.1
Using activesupport 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using io-console 0.5.9
Using nokogiri 1.12.5 (x86_64-linux)
Using reline 0.3.0
Using loofah 2.13.0
Using puma 5.5.2
Using bootsnap 1.9.3
Using rails-html-sanitizer 1.4.2
Using sprockets 4.0.2
Using irb 1.4.1
Using rack-test 1.1.0
Using debug 1.4.0
Using rails-dom-testing 2.0.3
Using globalid 1.0.0
Using actionview 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using activemodel 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using activejob 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using actionpack 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using jbuilder 2.11.5
Using activerecord 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using actioncable 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using sprockets-rails 3.4.2
Using actionmailer 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using railties 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using activestorage 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using actionmailbox 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using actiontext 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Using stimulus-rails 1.0.2
Using turbo-rails 1.0.0
Using jsbundling-rails 1.0.0
Using web-console 4.2.0
Using cssbundling-rails 1.0.0
Using rails 7.1.0.alpha from https://github.com/rails/rails.git (at main@ca6e314)
Bundle complete! 13 Gemfile dependencies, 56 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle binstubs bundler
       rails  javascript:install:webpack
Compile into app/assets/builds
      create  app/assets/builds
      create  app/assets/builds/.keep
      append  app/assets/config/manifest.js
Add JavaScript include tag in application layout
      insert  app/views/layouts/application.html.erb
Create default entrypoint in app/javascript/application.js
      create  app/javascript
      create  app/javascript/application.js
Add default package.json
      create  package.json
Add default Procfile.dev
      create  Procfile.dev
Ensure foreman is installed
         run  gem install foreman from "."
Successfully installed foreman-0.87.2
Parsing documentation for foreman-0.87.2
Done installing documentation for foreman after 0 seconds
1 gem installed
Add bin/dev to start foreman
      create  bin/dev
Install Webpack with config
      create  webpack.config.js
         run  yarn add webpack webpack-cli from "."
yarn add v1.22.17
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 102 new dependencies.
info Direct dependencies
├─ webpack-cli@4.9.1
└─ webpack@5.65.0
info All dependencies
├─ @discoveryjs/json-ext@0.5.6
├─ @types/eslint-scope@3.7.2
├─ @types/eslint@8.2.1
├─ @types/json-schema@7.0.9
├─ @types/node@17.0.5
├─ @webassemblyjs/floating-point-hex-parser@1.11.1
├─ @webassemblyjs/helper-numbers@1.11.1
├─ @webassemblyjs/helper-wasm-section@1.11.1
├─ @webassemblyjs/wasm-edit@1.11.1
├─ @webassemblyjs/wasm-opt@1.11.1
├─ @webassemblyjs/wast-printer@1.11.1
├─ @webpack-cli/configtest@1.1.0
├─ @webpack-cli/info@1.4.0
├─ @webpack-cli/serve@1.6.0
├─ @xtuc/ieee754@1.2.0
├─ acorn-import-assertions@1.8.0
├─ acorn@8.7.0
├─ ajv-keywords@3.5.2
├─ ajv@6.12.6
├─ browserslist@4.19.1
├─ buffer-from@1.1.2
├─ caniuse-lite@1.0.30001294
├─ chrome-trace-event@1.0.3
├─ clone-deep@4.0.1
├─ colorette@2.0.16
├─ commander@7.2.0
├─ cross-spawn@7.0.3
├─ electron-to-chromium@1.4.29
├─ enhanced-resolve@5.8.3
├─ envinfo@7.8.1
├─ es-module-lexer@0.9.3
├─ escalade@3.1.1
├─ eslint-scope@5.1.1
├─ esrecurse@4.3.0
├─ estraverse@4.3.0
├─ events@3.3.0
├─ execa@5.1.1
├─ fast-deep-equal@3.1.3
├─ fast-json-stable-stringify@2.1.0
├─ fastest-levenshtein@1.0.12
├─ find-up@4.1.0
├─ function-bind@1.1.1
├─ get-stream@6.0.1
├─ graceful-fs@4.2.8
├─ has-flag@4.0.0
├─ has@1.0.3
├─ human-signals@2.1.0
├─ import-local@3.0.3
├─ interpret@2.2.0
├─ is-core-module@2.8.0
├─ is-plain-object@2.0.4
├─ is-stream@2.0.1
├─ isexe@2.0.0
├─ isobject@3.0.1
├─ jest-worker@27.4.5
├─ json-parse-better-errors@1.0.2
├─ json-schema-traverse@0.4.1
├─ loader-runner@4.2.0
├─ locate-path@5.0.0
├─ mime-db@1.51.0
├─ mime-types@2.1.34
├─ mimic-fn@2.1.0
├─ neo-async@2.6.2
├─ node-releases@2.0.1
├─ npm-run-path@4.0.1
├─ onetime@5.1.2
├─ p-limit@2.3.0
├─ p-locate@4.1.0
├─ p-try@2.2.0
├─ path-exists@4.0.0
├─ path-key@3.1.1
├─ path-parse@1.0.7
├─ picocolors@1.0.0
├─ pkg-dir@4.2.0
├─ punycode@2.1.1
├─ randombytes@2.1.0
├─ rechoir@0.7.1
├─ resolve-cwd@3.0.0
├─ resolve-from@5.0.0
├─ resolve@1.20.0
├─ safe-buffer@5.2.1
├─ schema-utils@3.1.1
├─ serialize-javascript@6.0.0
├─ shallow-clone@3.0.1
├─ shebang-command@2.0.0
├─ shebang-regex@3.0.0
├─ signal-exit@3.0.6
├─ source-map-support@0.5.21
├─ source-map@0.6.1
├─ strip-final-newline@2.0.0
├─ supports-color@8.1.1
├─ tapable@2.2.1
├─ terser-webpack-plugin@5.3.0
├─ terser@5.10.0
├─ uri-js@4.4.1
├─ watchpack@2.3.1
├─ webpack-cli@4.9.1
├─ webpack-merge@5.8.0
├─ webpack-sources@3.2.2
├─ webpack@5.65.0
├─ which@2.0.2
└─ wildcard@2.0.0
Done in 3.40s.
Add build script
         run  npm set-script build "webpack --config webpack.config.js" from "."
         run  yarn build from "."
yarn run v1.22.17
$ webpack --config webpack.config.js
asset application.js 0 bytes [emitted] [minimized] (name: application)
./app/javascript/application.js 57 bytes [built] [code generated]
webpack 5.65.0 compiled successfully in 159 ms
Done in 0.63s.
       rails  turbo:install stimulus:install
Import Turbo
      append  app/javascript/application.js
Install Turbo
         run  yarn add @hotwired/turbo-rails from "."
yarn add v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 3 new dependencies.
info Direct dependencies
└─ @hotwired/turbo-rails@7.1.0
info All dependencies
├─ @hotwired/turbo-rails@7.1.0
├─ @hotwired/turbo@7.1.0
└─ @rails/actioncable@6.1.4
Done in 0.86s.
Run turbo:install:redis to switch on Redis and use it in development for turbo streams
Create controllers directory
      create  app/javascript/controllers
      create  app/javascript/controllers/index.js
      create  app/javascript/controllers/application.js
      create  app/javascript/controllers/hello_controller.js
Import Stimulus controllers
      append  app/javascript/application.js
Install Stimulus
         run  yarn add @hotwired/stimulus from "."
yarn add v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ @hotwired/stimulus@3.0.1
info All dependencies
└─ @hotwired/stimulus@3.0.1
Done in 0.83s.
       rails  css:install:bootstrap
Build into app/assets/builds
       exist  app/assets/builds
   identical  app/assets/builds/.keep
File unchanged! The supplied flag value not found!  app/assets/config/manifest.js
Stop linking stylesheets automatically
        gsub  app/assets/config/manifest.js
Remove app/assets/stylesheets/application.css so build output can take over
      remove  app/assets/stylesheets/application.css
Add stylesheet link tag in application layout
File unchanged! The supplied flag value not found!  app/views/layouts/application.html.erb
      append  Procfile.dev
Add bin/dev to start foreman
   identical  bin/dev
Install Bootstrap with Popperjs/core
      create  app/assets/stylesheets/application.bootstrap.scss
         run  yarn add sass bootstrap @popperjs/core from "."
yarn add v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 19 new dependencies.
info Direct dependencies
├─ @popperjs/core@2.11.0
├─ bootstrap@5.1.3
└─ sass@1.45.1
info All dependencies
├─ @popperjs/core@2.11.0
├─ anymatch@3.1.2
├─ binary-extensions@2.2.0
├─ bootstrap@5.1.3
├─ braces@3.0.2
├─ chokidar@3.5.2
├─ fill-range@7.0.1
├─ glob-parent@5.1.2
├─ immutable@4.0.0
├─ is-binary-path@2.1.0
├─ is-extglob@2.1.1
├─ is-glob@4.0.3
├─ is-number@7.0.0
├─ normalize-path@3.0.0
├─ picomatch@2.3.0
├─ readdirp@3.6.0
├─ sass@1.45.1
├─ source-map-js@1.0.1
└─ to-regex-range@5.0.1
Done in 1.23s.
Appending Bootstrap JavaScript import to default entry point
      append  app/javascript/application.js
Add build:css script
         run  npm set-script build:css "sass ./app/assets/stylesheets/application.bootstrap.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules" from "."
         run  yarn build:css from "."
yarn run v1.22.17
$ sass ./app/assets/stylesheets/application.bootstrap.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules
Done in 1.65s.

发生这种情况的任何原因以及如何实现 rails 7.0.0

这个运行的输出是什么? gem list rails --local

您似乎安装了多个版本的 rails,rails new 将从最新版本生成。

您可以 rails _7.0.0_ new my_app -T --database=postgresql --javascript=webpack --css=bootstrap 使用 rails 版本 7.0.0。

rails new 的参数 --css=bootstrap 似乎自动强制 --javascript=esbuild(和 rails 7.1 alpha)。
我已经研究了这个站点以进行救援:https://dev.to/coorasse/rails-7-bootstrap-5-and-importmaps-without-nodejs-4g8