ruby-on-rails - rails Assets :precompile Yarn executable was not detected in the system

标签 ruby-on-rails linux ubuntu yarnpkg

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

当我按照 Post 中的安装说明进行操作时或在 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

关于ruby-on-rails - rails Assets :precompile Yarn executable was not detected in the system,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45498313/

相关文章:

ruby-on-rails - Ruby on Rails 中的当前年份

linux - 为什么 gcc 默认链接 '-z now',尽管延迟绑定(bind)是 ld 的默认值?

linux - unix中的csv文件操作并将值附加到每一行

mysql - 授予 mysql 数据库权限时出现特殊字符问题

ruby-on-rails - 无法安装 RMagick 2.16.0

ruby-on-rails - 您如何在 Rails 3.1 中使用 Sprockets 编写干燥的模块化 CoffeeScript ?

html - html.erb 文件中的类名分隔

linux - 使用命令行删除逗号之间的空格

ubuntu - 从源代码编译 cpabe 包时链接 gmp 时出错

python-2.7 - 安装后无法在ubuntu中启动RIDE.py