react_on_rails install: yarn is required error

Viewed 748

I am trying to setup react_on_rails for an existing rails 5.0 app as per the following instructions: https://github.com/shakacode/react_on_rails

  1. gem "react_on_rails", "8.0.0"
  2. rails generate react_on_rails:install

I get the following error:

ERROR: yarn is required. Please install it before continuing. https://yarnpkg.com/en/docs/install

now this is my yarn, npm and node path:

[user@server]$ which node
/usr/bin/node
[user@server]$ which npm
/usr/bin/npm
[user@server]$ which yarn
~/.yarn/bin/yarn

How do i ensure it's using the appropriate yarn and help install react_on_rails?

EDIT: This is my ~/.bashrc file:

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"


export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

export PATH="$PATH:$HOME/.yarn/bin"

This is my /bin/yarn file under my app:

#!/usr/bin/env ruby
VENDOR_PATH = File.expand_path('..', __dir__)
Dir.chdir(VENDOR_PATH) do
  begin
    exec "yarnpkg #{ARGV.join(" ")}"
  rescue Errno::ENOENT
    $stderr.puts "Yarn executable was not detected in the system."
    $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
    exit 1
  end
end
2 Answers
Related