安装 bundler 报错:5 H' w. S m% I0 S2 f
# [ M5 i* @; T2 s
) T% e2 w# K3 |. d: U+ |2 y" Y6 V# F5 b! F# Y. M H( G
ERROR: Could not find a valid gem 'bundler' (= 1.17.3), here is why: 2 `1 H# l+ T. N* G0 }7 y( O: h+ t 0 e F M5 r) e. ^$ FUnable to download data from https://rubygems.org/ - Errno::ENETUNREACH: Network is unreachable - connect(2) for "api.rubygems.org" port 443 (https://api.rubygems.org/specs.4.8.gz)) q- k4 [) d, U) j1 {
: p5 f" @ J% A# z A( c" w4 a" a( a% [ g: `
7 o* Z5 n& E( Z7 x3 R1 Q+ k 1.添加国内源:- y0 i+ W1 t, A
% e. O B. h! k) T# V
# t& n+ A0 m3 T% {( D. F
9 a) L4 e; N- j8 Bgem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/9 U& N8 [; v, s5 d3 c
& F- J3 [: ^8 y8 ~- r 9 |2 S7 G1 }! D5 ?+ X+ X$ l" v/ ^& P. U, r- e, Y2 X2 k' o* H3 X. l
cd /home/root/dldl-gm && sh restart-alpha.sh @8 g& H+ |6 P: H7 c
; |/ W4 v O* d) b( O; T5 z7 S1 b2 _- N, G
- t. ^; @, d5 L: S1 b( w Y会报错如下:7 a+ Z. `) F1 Q( X' @6 D0 L7 u5 d
$ |! ~9 D+ V1 `9 b$ i' G; x9 y3 ] 7 h% G. T9 p% m _; o1 S5 B* w: F/ A; `* J d* ]
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this 6 Y' T# m6 X: `5 ^/ ?9 B8 g2 V& B% f$ E 8 G% H: o: S" ~: [6 a& Capplication for all non-root users on this machine. 6 Y2 G: c. ^! l / i! j- ^& e' d! ?! B9 WFetching source index from http://rubygems.org/ 5 p3 q& E2 v0 H. }( p# i3 z . \* S! f! A- e+ a) ?- G 4 V: S, n, {+ N$ e$ R# K& B! P; ?# c: t
Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/( ?% o" P' l0 D: [
" I. B2 N/ M2 v: F+ YRetrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/ 7 n# j1 \3 D$ K6 X6 h + u9 _* t( B' H" l% J 2 b8 D t$ W/ j4 h: _9 K# f( X4 s9 @5 r& A( t; e+ U j( H 解决方案一:全局配置 Bundler 使用 Ruby China 镜像(HTTPS)1 v# C0 B* K5 }6 {+ |% M
' n7 c M# c1 {0 c$ i+ J4 i5 L
! ^3 E8 s N7 q/ K1 v F 3 t0 a g2 m- M8 V: mbundle config set --global mirror.http://rubygems.org https://gems.ruby-china.com2 v6 ~# A6 Q1 I- e
+ C7 q9 |( ^& u0 [7 F! S: g3 tbundle config set --global mirror.https://rubygems.org https://gems.ruby-china.com # C. J! f- n0 _ ! G5 K W/ I' n) j) t, y 7 n8 {9 \/ k" Y8 J9 j/ P- ? 8 E: s: ~. ?3 X y验证配置:' O0 i4 F- F' A* \) F# {' M4 s% T2 A
1 ~1 n) E# `' G
* Z3 ]7 J7 y! f
7 Y7 ] @! m" ^3 l2 R, ]7 N : ?* c' i! ]: D * i& X* q, m" p* s0 ^( A应看到类似:( E( R- D' }7 [1 h5 V8 ?6 z! o
/ w% j* m1 m! l7 r5 @ # G( G, g ]. k" c# m Q) m/ L7 _6 f; e( M6 b
Settings are listed in order of priority. The top value will be used. $ x' L/ b$ i; X& s$ S% M& n% t! F+ f2 C# ^% H k3 Y
mirror.http://rubygems.org ) t8 C0 `; m1 ~- z5 w( l# c4 h; l* ?$ P* ?: I9 b H. x* p* {
Set via BUNDLE_MIRROR__HTTP://RUBYGEMS__ORG: "https://gems.ruby-china.com": [2 Z8 c5 E7 h: @
: Z a) k6 O8 G7 O) v
mirror.https://rubygems.org0 f0 ~% l! A6 T- u
# T% n1 W" l4 ~' kSet via BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG: "https://gems.ruby-china.com"4 P+ x9 f. i* g( v/ X( B