Rails 7: 找不到生成器 ‘stimulus’

huangapple go评论63阅读模式
英文:

Rails 7: Could not find generator 'stimulus'

问题

我最近将我们的应用程序升级到Rails 7,并希望使用Stimulus。我了解到在Rails 7中,默认情况下会带有Stimulus。

我尝试执行rails generate stimulus Downloader,但结果是找不到生成器 'stimulus'。

我需要执行其他任何步骤来使用Stimulus吗?

在这方面有任何帮助将会很好,谢谢。

英文:

I have recently upgraded our application to Rails 7 and want to use Stimulus. I understand that with Rails 7 its comes by default.

I am trying to execute rails generate stimulus Downloader but this results in Could not find generator 'stimulus'.

Are there any additional steps i need to perform to use Stimulus?

Any help here would be great, thanks.

答案1

得分: 1

它以 stimulus-rails gem 的形式随 rails 7 一起提供:
https://github.com/hotwired/stimulus-rails#installing-with-installer

bundle add stimulus-rails
bin/rails stimulus:install

其他所有内容也以 gem 的形式提供,包括 importmap-railsjsbundling-railscssbundling-railsturbo-railstailwindcss-rails - 当您使用 rails new 创建新应用时,rails 会为您运行相应的安装任务。对于现有的应用程序,您必须按照每个 gem 的安装说明进行安装。

英文:

It comes with rails 7 in a form of a gem stimulus-rails:
https://github.com/hotwired/stimulus-rails#installing-with-installer

bundle add stimulus-rails
bin/rails stimulus:install

Everything else also comes in a gem importmap-rails, jsbundling-rails, cssbundling-rails, turbo-rails, tailwindcss-rails - and has an install task which rails runs for you when making a new app with rails new. For existing apps you have to follow install instructions for each gem.

huangapple
  • 本文由 发表于 2023年7月13日 16:30:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76677381.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定