我試圖建立react_on_rails爲現有軌道5.0應用程序按照以下說明: https://github.com/shakacode/react_on_railsreact_on_rails安裝:紗所需錯誤
- 寶石「react_on_rails」,「8.0.0」
- 軌產生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
您使用的是什麼操作系統,以及您是如何安裝紗線的? –
你可以運行'yarn install'嗎?什麼是輸出? – Anthony
如果您在釀造時安裝紗線,效果會更好。但無論如何,請在[docs](https://yarnpkg.com/en/docs/install)中介紹如何在'.bashrc'中添加以下內容:'export PATH =「$ PATH:'yarn global bin'」'能夠全局訪問Yarn的可執行文件,並確保你已經用'source〜/ .bash_profile'重新加載了你的'〜/ .bashrc'文件。 – iskvmk