+ Z$ k( d/ C- f& h4 [' k/ j7 F5 _: y' P1 r0 d
G' X8 d4 |/ m, ]+ }7 C `
ERROR: Could not find a valid gem 'bundler' (= 1.17.3), here is why:: o. p9 k( K3 B F; t2 ]3 n
# N" ?$ I5 b, Z
Unable 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)8 L% e9 r k' H7 a6 o1 Z9 x& O
1 `9 o1 N) D& F& D6 O/ N ! b% H' F7 @1 c, ^$ d5 ?2 N $ d/ F' v' z4 _. c# l9 w }1.添加国内源:* u E, i/ U6 S* j. v, R% a y" z
% W& A4 C. s+ `( h 5 d/ R9 }- E6 C7 u, E. _- b( C. W2 T( r8 J3 h' p& M9 g8 P8 b
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/ ! z! b# r) }! h2 u$ M( N 8 U( t6 J( k! t % i$ T; y: P1 r* \% D; [0 s- l ! y- k& X6 w* S {# h7 u: G( G6 n注意:如果之前自己瞎捣鼓已配置过源,建议先清理:$ I) ^' x5 _8 j2 }! p
% U; E+ W0 @$ g9 b ; A3 J- Q( |& C/ c: r本地安装: c5 e. y0 Z& T! [/ t& b; a' g5 z3 L9 h o5 s5 n
. p9 ~, O. B( w6 ~5 H- M% t( A( X/ ^8 h" p/ |9 W L
gem install ./bundler-1.17.3.gem( y' n; i* [( k) z
, \1 U a* | D" S. `. J+ f7 i5 Q
* c, w8 x/ P' {
- z! @/ u8 c6 U+ L, q1 }) P 安装完成后运行: 1 j4 j- t% G( M1 i, y+ |% j5 w 6 K* x. h7 b9 n! W, G- ~) j$ H h" ]) |, X4 R7 z/ f+ D
, u2 t8 z& g- T0 A$ i" u1 Y- O) n9 obundle -v 1 F3 W. Q% B5 ]& ^* A * a; A% K, j0 Z 2 O& D H) z7 I' a% |- k( ]5 S" E f9 |! G9 b6 r3 P应输出: L4 u- l. ?8 M2 j * F5 g+ M* J, J; `/ P. m" m/ w* _$ V7 \9 v
5 v) F1 C$ T! L n- d' Y+ |7 ?% c
Bundler version 1.17.3 0 e2 ]' m/ l+ D7 b' d' D2 I* |% V! u: s( e+ p# e( |; O
8 l7 X1 s+ [2 Y3 V. j8 d
7 ^+ _( Z8 c; K" n, z9 s 到这里环境已经安装成功!安装依赖并启动:+ h* W9 x& @1 }* j: v. m
2 V) h: T6 y3 | u
7 D3 v% G3 @* S3 S, Q/ @! ?9 t( d3 ~, Z1 E
cd /home/root/dldl-gm && sh restart-alpha.sh ; C1 R1 A+ r$ s2 ~; x& i ' P3 \* g& u8 y- k3 X8 V5 q. P% K; M$ g v! V) ]' M: f
5 M/ u2 n5 v5 i: h+ \/ Y. F! [会报错如下: 7 i" z% c# D! r0 V 9 l# o( D% {: Z& m0 Q8 A5 d( r4 e' x7 ?4 c
) ~+ V u8 k+ qDon't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this" q) z6 m. j$ P- d. Z* y
/ S- S$ X( p5 k9 ~
application for all non-root users on this machine. & R ~$ C# P' e 9 n2 G6 j T ?1 hFetching source index from http://rubygems.org/4 q! l1 S8 a5 D+ z0 \
4 J0 [& L \) ^ * p: l% ?" t% j+ I) P( I, ^, D! w8 r \ y% Q
Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/ 1 W7 j2 k" k3 J* g5 o) Q- L) x z
Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/ ! Q# h1 p4 P: `) m/ q5 h. P [% _5 l2 a3 I+ `$ j# k* D* W) D1 b) v
8 v5 E- c+ ?6 @% X+ `( ?$ r
8 C: G. ^; }8 e. [# f7 M$ m& C0 Z 解决方案一:全局配置 Bundler 使用 Ruby China 镜像(HTTPS) ' l- j8 W9 h1 p5 E: i6 d2 A6 c i6 X5 Q. U4 g# g# |
U- N( B$ h' }: O3 Y% W* D- B. B. l3 c5 t
bundle config set --global mirror.http://rubygems.org https://gems.ruby-china.com( T$ i* `/ W' d- j7 T
6 E1 r! [5 X" ~& ?2 ?
bundle config set --global mirror.https://rubygems.org https://gems.ruby-china.com& {# A" b/ o, `" G4 w
e" ~# @' e3 g; y4 k
9 s2 X5 G7 ^5 i g) k v! E" ^) Y: \/ t ; L3 n7 M) D! v: y把文件里面的:http://rubygems.org/ 改为 https://gems.ruby-china.com/ " ]: L/ J! }, r& y3 W ' W( g( X- f" z: p; u% \3 S( L# {* [ ! t; K3 _. O, C. a$ @( r: d3 r) o a5 |" h 重新安装依赖并启动: & u7 s1 I0 d- `+ S/ P5 ~% B8 H, q5 c6 T2 a& Q d& Z7 Y9 j
- v( {; _1 V, r H1 j l/ ^5 _% d3 C
cd /home/root/dldl-gm && sh restart-alpha.sh 1 S6 z1 s/ K7 D8 {6 {* f . N; T% I X2 n5 q7 R( D4 J. S/ }3 P7 Z/ \3 P+ M. q' P
% @ ^% o- B% R应看到类似:+ w6 O) ~' b' t: _
" J# U8 v# J g
5 @ E6 _. h( z! g+ W9 v! y& K( K: B; X
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 v3 P! }' u9 s- [ i- C ' j. k% a# F" Q5 ]% w& bapplication for all non-root users on this machine.7 }0 V R& z& [
, E* u; z, G7 F; j% l" p$ r4 p$ F0 h% |; RFetching gem metadata from https://gems.ruby-china.com/..........% f7 n- X* o5 _1 i# O p
7 D1 m: J! P; e J6 ~4 A
Fetching rake 12.3.13 M' A- j p3 T& V- v
: J( O$ G E0 A. t7 |$ JInstalling rake 12.3.1 * B( w0 H# D; Z; U+ q# F j' |2 h% M; N6 G4 ~0 \
Fetching concurrent-ruby 1.0.5; V2 T; w, d9 _4 [8 F+ g
J0 Y4 l2 B9 m9 J% }
- w, r* ^0 H6 o
8 `' L$ e5 F4 z恭喜您,这就是已经在正常安装依赖了!6 n- N! ]4 r+ L3 A3 D0 j, U1 R N