react_on_rails安装:yarn是必需的错误
我正在尝试根据以下说明为现有的rails 5.0应用程序设置react_on_rails: https : //github.com/shakacode/react_on_rails
- gem“react_on_rails”,“8.0.0”
- rails生成react_on_rails:install
我得到以下错误:
ERROR: yarn is required. Please install it before continuing. https://yarnpkg.com/en/docs/install
现在这是我的纱线npm和节点path:
[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"
这是我的应用程序下的我的/ 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
你可以使用yarn
而不是yarnpkg
吗?
exec "yarn #{ARGV.join(" ")}"
不知道如果一个下面的固定它:
unset https_proxy unset http_proxy npm config set proxy http://user:****@ip npm config set https-proxy http://user:***@ip
之后,纱线工作。