Rails7 Rails_env =生产导轨资产:预编译错误命令“构建”未找到

发布于 2025-01-21 21:56:18 字数 8 浏览 4 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

七秒鱼° 2025-01-28 21:56:18

好..我想出了如何做猴子补丁(叹气)。

将其添加到package.json

  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "echo 1",
    "build:css": "echo 1"
  },

这无法使用YARN/NPM THO(我不需要它们)来解决Rails Prod Prod Predrocersor的问题。

Well.. I figured out how to do a monkey patch(Sigh..).

Add this to package.json:

  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "echo 1",
    "build:css": "echo 1"
  },

This does not resolve the issue of rails prod preprocessor using yarn/npm tho(i dont need them).

雪若未夕 2025-01-28 21:56:18

感谢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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文