react_on_rails安装:纱线是必需的错误

时间:2017-08-16 18:29:50

标签: ruby-on-rails node.js ruby reactjs yarnpkg

我正在尝试按照以下说明为现有的rails 5.0应用设置react_on_rails: https://github.com/shakacode/react_on_rails

  1. gem" react_on_rails"," 8.0.0"
  2. rails generate react_on_rails:install
  3. 我收到以下错误:

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

    现在这是我的纱线,npm和节点路径:

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

    我如何确保使用合适的纱线并帮助安装react_on_rails?

    编辑:这是我的〜/ .bashrc文件:

    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"
    

    这是我的app下的/ bin / yarn文件:

    #!/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 个答案:

答案 0 :(得分:0)

您可以仅使用yarn代替yarnpkg吗?

exec "yarn #{ARGV.join(" ")}"

答案 1 :(得分:0)

不确定是否有以下修复者:

close()

纱线工作后。