rails assets:precompile 系统中未检测到 Yarn 可执行文件

rails assets:precompile Yarn executable was not detected in the system

我正在使用基于 Ubunt 17.04 的 Linux 18。 当我 运行 rails assets:precompile 我收到以下消息 Yarn executable was not detected in the system

当我按照 or on the Webpage 中的说明进行安装时,我成功安装了 Yarn,但是 rails 一直给我错误

我注意到 node.js 有 Linux Mint 到 17.2 版本的系统包,我尝试执行 Yarn 页面的所有说明并手动安装node.js 已经安装在我的系统中。

该消息并没有真正解释问题。如果我 运行 yarn --help 它有效并且我的 yarn --version0.22

这是我的 Linux Mint 系统

DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18
DISTRIB_CODENAME=sarah
DISTRIB_DESCRIPTION="Linux Mint 18 Sarah"
NAME="Ubuntu"
VERSION="16.04 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
UBUNTU_CODENAME=xenial
cat: /etc/upstream-release: Is a directory

更新

这是我在终端 /opt/yarn-0.22/bin 中回显 $PATH 的输出,但是当我转到该路径时,没有文件夹 /opt/yarn-0.22 所以我需要了解它在哪里已安装并正确配置 PATH SETUP

Path Setup

If you chose manual installation, the following steps will add Yarn to path variable and run it from anywhere.

Note: your profile may be in your .profile, .bash_profile, .bashrc, .zshrc, etc.

Add this to your profile: export PATH="$PATH:/opt/yarn-[version]/bin" (the path may vary depending on where you extracted Yarn to)
In the terminal, log in and log out for the changes to take effect
To have access to Yarn’s executables globally, you will need to set up the PATH environment variable in your terminal. To do this, add export PATH="$PATH:`yarn global bin`" to your profile.

非常感谢 最好的祝福 法布里齐奥·贝尔托利奥

yarn 是节点包管理器yarn

你必须按照这里的说明安装它installation guide 如果你有 node 和 npm,你可以安装它 通过

npm install yarn -g


If you dont have npm in your machine go to this link and install node which will also install npm


If you want to manage multiple version node like RVM then you need to checkout this link