【问题标题】:rails assets:precompile Yarn executable was not detected in the systemrails assets:precompile Yarn 可执行文件未在系统中检测到
【发布时间】:2017-08-04 04:31:56
【问题描述】:

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

当我按照PostWebpage 中的安装说明进行操作时,我成功安装了 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 所以我需要了解它的安装位置并正确配置@987654336 @

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 cli作为全局包吗?
  • @uzaif 嗨,你是对的。这是我的echo $PATH 在终端/opt/yarn-0.22/bin 中的输出,但是当我转到该路径时,没有文件夹/opt/yarn-0.22 所以我需要了解它的安装位置并正确配置PATH SETUP
  • 安装在 home 下的全局 node_module 目录中
  • @uzaif 你有 linux mint 吗?我在/usr/bin 中有可执行文件,我可以使用/usr/bin/yarnyarn.. 运行纱线,但可能当rbenv 运行yarn 命令时,它只是不起作用。我确实在我的 bash 配置文件中包含了 export PATH="$PATH:/usr/bin/yarn" 在 Linux 中,/ 是根目录,/home/<username/ 是用户目录。 Yarn 安装在根目录中,要使用 yarn 命令执行,我应该在我的 $PATH 变量中包含 export PATH="$PATH:/usr/bin/yarn"
  • @uzaif 没有使用 webpacker 或 create-react-app ...我只是在使用 rails,不知道为什么这个yarn 出来了.. 我正在使用一些 jquery 插件...现在无法真正确定真正的问题。这个解决方案应该没问题..你可以发布你的答案我会接受谢谢

标签: ruby-on-rails linux ubuntu yarnpkg


【解决方案1】:

yarn 是节点包管理器yarn

您必须按照此处的说明安装它installation guide 如果你有 node 和 npm 你可以安装它 通过

npm install yarn -g


如果您的机器中没有npm,请转到this link 并安装node,这也将安装npm


如果你想管理多个版本节点,比如RVM,那么你需要签出this link

【讨论】:

    猜你喜欢
    • 2020-11-16
    • 2018-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多