我使用的是基于 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 --version
是 0.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 installnode
which will also installnpm
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/