2017-08-16 28 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 

之後紗工作。