You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Shakapacker时出现找不到@hotwired/turbo-rails模块错误求助

求助:Shakapacker环境下提示找不到@hotwired/turbo-rails模块

我正在使用Shakapacker(项目基于react-rails),已经严格遵循Shakapacker入门章节的所有步骤操作,但还是碰到错误:Uncaught Error: Cannot find module '@hotwired/turbo-rails',不清楚问题出在哪,麻烦大家帮忙看看。

相关配置文件内容

config/importmap.rb

# Pin npm packages by running ./bin/importmap

pin "application", preload: true
pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
pin_all_from "app/javascript/controllers", under: "controllers"

app/javascript/application.js

import "@hotwired/turbo-rails" 
import "controllers"

错误截图

错误截图

内容的提问来源于stack exchange,提问作者CoolGuy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.01 07:10:14