未检测到 Rails 预编译资产 Yarn 可执行文件 [英] Rails precompile assets Yarn executable was not detected

查看:23
本文介绍了未检测到 Rails 预编译资产 Yarn 可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从 Rails 5.0 转换到 Rails 5.1.0 的 Rails 项目.当我尝试预编译资产时,我收到以下错误消息:

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

我从互联网搜索中读到的所有内容都说 yarn 和 webpacker 带有 Rails 5.1.我从检查 rails 版本中得到以下信息.

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.

推荐答案

Rails 5.1 自带了对 yarn 和 webpack 的支持,但是你需要自己安装它们.Yarn 是一个包管理器,而 webpack 是一个包.

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.

按照 https://yarnpkg.com/lang/en/docs/install/中的说明进行操作 在您的系统中安装 Yarn,然后将 webpack 添加到您的项目中,例如:

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

此外,您看到的消息是警告,而不是直接的错误.如果你不需要使用任何花哨的 js 包,你可以使用好的 ol' 资产管道

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

这篇关于未检测到 Rails 预编译资产 Yarn 可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆