问题
I am using Linux 18 based on Ubunt 17.04.
When I run rails assets:precompile
I get the following message Yarn executable was not detected in the system
When I follow the instruction for the installation like in this Post or on the Webpage, I install Yarn successfully, but rails keeps giving me the error
I notice that node.js has system packages for Linux Mint up to version 17.2
, I tried to do all the instruction for the Yarn
page and install manually node.js
which was already installed in my system.
The message is not really explanatory of the problem. If I run yarn --help
it works and my yarn --version
is 0.22
This is my Linux Mint system
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
Update
This is the output of my echo $PATH
in the terminal /opt/yarn-0.22/bin
, but when I go to that path, there is no folder /opt/yarn-0.22
so I need to understand where it was installed and configure correctly the 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.
Thanks a lot Best Regards Fabrizio Bertoglio
回答1:
yarn is node package manager yarn
you have to install it as here instrauction installation guide If you have node and npm you can install it via
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
来源:https://stackoverflow.com/questions/45498313/rails-assetsprecompile-yarn-executable-was-not-detected-in-the-system