Rails precompile assets Yarn executable was not detected

泪湿孤枕 提交于 2019-11-28 07:14:10

问题


I have a Rails project that we converted from Rails 5.0 to Rails 5.1.0. When I try to precompile the assets, I get the following error message:

Yarn executable was not detected in the system.
Download Yarn at https://yarnpkg.com/en/docs/install

Everything I read from an internet search says yarn and webpacker comes with Rails 5.1. I get the following from check the rails version.

$rails --version
Rails 5.1.0

How do I fix this? I'd also like to know what is happening.


回答1:


Rails 5.1 comes with SUPPORT for yarn and webpack, but you need to install them yourself. Yarn is a package manager and webpack is a package.

Follow instruction at https://yarnpkg.com/lang/en/docs/install/ to install Yarn in your system and then add webpack to your project like:

yarn add --dev webpack webpack-dev-server

Additionally, the message you're seeing is warning, rather than straight up error. If you do not need to use any of the fancy js packages, you can just use good ol' asset pipeline




回答2:


You could just remove bin/yarn from your App directory if you're not using yarn/webpacker to avoid the log message.



来源:https://stackoverflow.com/questions/45486362/rails-precompile-assets-yarn-executable-was-not-detected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!