2017-08-16 27 views
5

我试图建立react_on_rails为现有轨道5.0应用程序按照以下说明: https://github.com/shakacode/react_on_railsreact_on_rails安装:纱所需错误

  1. 宝石“react_on_rails”,“8.0.0”
  2. 轨产生react_on_rails:安装

我得到以下错误:

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

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

[[email protected]]$ which node 
/usr/bin/node 
[[email protected]]$ which npm 
/usr/bin/npm 
[[email protected]]$ 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" 

这是我的应用程序在我的/ bin中/纱文件:

#!/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 
+0

您使用的是什么操作系统,以及您是如何安装纱线的? –

+0

你可以运行'yarn install'吗?什么是输出? – Anthony

+0

如果您在酿造时安装纱线,效果会更好。但无论如何,请在[docs](https://yarnpkg.com/en/docs/install)中介绍如何在'.bashrc'中添加以下内容:'export PATH =“$ PATH:'yarn global bin'”'能够全局访问Yarn的可执行文件,并确保你已经用'source〜/ .bash_profile'重新加载了你的'〜/ .bashrc'文件。 – iskvmk

回答

0

您可以使用刚刚yarn代替yarnpkg

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

不知道如果一个下列固定它:

unset https_proxy 
unset http_proxy 

npm config set proxy http://user:****@ip 
npm config set https-proxy http://user:***@ip 

之后纱工作。