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

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

问题描述

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

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的SUPPORT,但是您需要自己安装它们. 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/zh-CN/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包,则可以使用优质的资产管道

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天全站免登陆