Rails7 Rails_env =生产导轨资产:预编译错误命令“构建”未找到
continue
Extremly odd error, asset precompilation works fine in dev mode, but as soon as i do production mode, i get error:
root@53407ec15126:/app# RAILS_ENV=production rails assets:precompile
yarn install v1.22.18
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.04s.
yarn run v1.22.18
error Command "build" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
rails aborted!
jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors
Tasks: TOP => assets:precompile => javascript:build
(See full trace by running task with --trace)
root@53407ec15126:/chinese-flashcards-app#
And the weirdest thing is, i dont even use yarn in my project(i use importmaps).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好..我想出了如何做猴子补丁(叹气)。
将其添加到
package.json
:这无法使用YARN/NPM THO(我不需要它们)来解决Rails Prod Prod Predrocersor的问题。
Well.. I figured out how to do a monkey patch(Sigh..).
Add this to
package.json
:This does not resolve the issue of rails prod preprocessor using yarn/npm tho(i dont need them).
感谢IVrrimum,我一直在寻找此修复程序。确保您的ImportMaps,如果您使用的是Rails 7,请确保也正确设置。我发现这些指南很有用:
https:// https://www.learnenough.com/博客/迁移 - 避开障碍 - webpacker
https://eagerworks.com/blog/import-maps/import-maps-ingog/import-maps-ingog-in-rails- 7
Thanks IvRRimUm I've been searching for this fix for ages. Make sure your importmaps and if you're using rails 7 ensure that is set up properly also. I found these guides useful:
https://www.learnenough.com/blog/migrating-away-from-rails-webpacker
https://eagerworks.com/blog/import-maps-in-rails-7