' S+ s0 P, t& j) H8 V' ^7 p* c- s8 E) e H 安装完成后运行:: J! y; U$ r. c- b
, C2 C4 M# g' S3 ~9 N+ f% E
9 U, |% O& E1 F \
; m! q2 H- C2 p# x P7 N6 h8 ]/ b
bundle -v5 _, [3 x# E4 z9 J4 ^
$ i! {/ H: {: h( |- A0 N, P# y5 r) \- l- Q5 b: c2 L
2 X' P2 ^' ?4 A7 L 应输出:# d( ~7 X1 S# T, A0 L* x' l7 M+ z
3 y8 g( W& h8 b* X
" y# [6 ?+ U4 @) N' z) [1 `% E% u0 o. F
Bundler version 1.17.3 - X: P; P8 S ]& a ( D2 u7 w# P9 w' z. o% Y2 d* |; j$ Y) R% K
; g5 F4 _: ~; z 到这里环境已经安装成功!安装依赖并启动: S- h: t2 s# u, z& Q
4 m/ G x0 G$ E. V2 P1 F5 b
( p: m2 N Z- h, d) `
# n% m2 ?6 i/ {$ d4 J0 a( bcd /home/root/dldl-gm && sh restart-alpha.sh: V/ _( Z" A6 s# T g; q4 a6 E3 L
8 s' H, K8 T& ?8 L; J- K
: N* g( Y6 ~& p+ S1 w2 b1 [9 @
$ n, k! S/ |- E' ^! e3 W6 q会报错如下:) Y( k3 f* D" p4 f& ?
, }7 h+ a J5 |6 ]" R) g ' x( `( l. z% Q7 ]2 ]* n# |6 o8 w5 u" S a+ }* m$ r
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this9 S9 p+ Y8 B' M( \5 @
, d9 s3 a; @! H8 D$ capplication for all non-root users on this machine. / i! Q0 N" `6 T# i 8 [8 u; P# z' z/ F; ~3 I7 eFetching source index from http://rubygems.org/ % N1 a: k* r7 V1 E% s! f( D; v + O2 v" b: w2 N, {) ^) g7 }. q/ j1 m/ C y+ X3 a2 b& l& e
4 `! I# X; ?3 \) gRetrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/ + W& B: V" o! ?0 I 1 d' z. b3 f6 a) H. p' a1 YRetrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/ 4 K. C$ N8 X5 l. t0 a: a6 ^5 x3 t0 M9 ` Q; i, U& H1 ?. j" V# V2 c
$ v, h f! V- \. T. |9 n" Y3 m) ^
" E) z5 M, _2 K5 m0 @解决方案一:全局配置 Bundler 使用 Ruby China 镜像(HTTPS) ( k& o3 V! t5 f( K- t' `* ^- Q5 D
, k6 S9 C& |3 J! m$ p0 w
) d* h4 l# N1 d" u7 R! d& F9 M: {8 Zbundle config set --global mirror.http://rubygems.org https://gems.ruby-china.com : |' P' k- q+ G. ~7 B" ? : D/ l% O, p4 Mbundle config set --global mirror.https://rubygems.org https://gems.ruby-china.com 0 G; O& A9 l3 i. p: M n7 y% w% T5 f" }% N4 Y8 ~. k+ K$ w: R+ W x( j( O4 ~ z
0 R9 K0 A; r' X" A& t, [; S+ S 验证配置: " l4 \* V# A4 z: s! Q) l 3 h/ [3 z. l3 j6 x1 B2 C( z' f7 [. G f5 h9 h) }2 s
8 t# o, F. u, S- K3 n* n- K* b- U7 g6 Ubundle config list" G0 y3 f8 V& _0 s6 t
4 L3 r: N+ M3 [! W ! P$ e# T, I _0 o7 [: T! Z i# H" w 应看到类似: 1 _" C" G# N' Q2 ~1 _4 j7 W, {2 o
" i6 i3 V1 w. s; r' j
# y$ N! l$ W' @( |8 _Settings are listed in order of priority. The top value will be used. $ E' L; Z2 G8 T" F$ |4 }, @ ' k# V& h( Q( ?4 i5 h3 b' M6 ^mirror.http://rubygems.org% P3 D. l! ^% A
& }/ p8 H. [) T# x- ]& o; w- ESet via BUNDLE_MIRROR__HTTP://RUBYGEMS__ORG: "https://gems.ruby-china.com"* R; l/ J' U1 P/ V7 w
0 j" z* S" E+ \" U% Z3 a
mirror.https://rubygems.org 4 y' q' l$ g' ]# Q5 x! L : o! I3 X) _8 K6 ISet via BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG: "https://gems.ruby-china.com" ) u3 j( k6 k& H0 U- X8 p% N: Z4 [8 ]2 H0 Q6 I1 J- l
4 z5 ^ ?+ ]3 V& D7 e" Q- X7 o% l* A( a8 g 这会把所有对 rubygems.org 的请求(无论 HTTP/HTTPS)都重定向到 https://gems.ruby-china.com解决方案二:4 w( P: u9 T! [# l' k
6 O" J* J# }. _6 f' g
3 R8 Y! v# T* L) R( T a! c- L8 S + h Q4 ?0 Q4 L. {打开:/home/root/dldl-gm/Gemfile和Gemfile.lock , ]) ~/ z, R3 O1 P+ H: D4 G% G# w2 b4 C& Y
2 p& s2 u x2 h T& z, v$ P
2 s/ |4 |9 k3 @6 m9 @, E0 ?3 T $ U# V' i: z4 G) e( U; a) l& q3 e/ Z( R7 _/ g$ @! e
1 F0 \3 f4 h1 K6 L+ ^6 Q8 ^( a, d( W0 V2 ]6 o2 J. C$ Y
把文件里面的:http://rubygems.org/ 改为 https://gems.ruby-china.com/ / d, ` _6 F6 {+ Y+ U% T1 @- M! d& R0 x
- X* l k2 _/ v/ f
, e, c e& C- g9 K重新安装依赖并启动: % Z7 s8 t/ O9 a. }4 \5 \$ g, D4 L( O2 j0 B _: Y* C& y' y
! X$ t8 Q$ R: B5 A0 b% h # f1 ^3 i2 A! G8 D$ H4 EDon't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this2 {1 A4 S. B+ O, O6 h
: d- i S% R9 a4 J* m$ i8 M/ yapplication for all non-root users on this machine. 4 |/ C3 \0 i5 ?* k( j+ _) e" |6 r0 D. m- o- x( H
Fetching gem metadata from https://gems.ruby-china.com/..........1 d- R1 c Y0 ]- s2 U. E8 T
1 }) \, _% K5 ~; G$ i7 e' nFetching rake 12.3.1$ U- P( V. i+ i" Y
0 {- A- s" o2 h. B* D) P ~- S6 D
Installing rake 12.3.1 2 d9 _3 F, F8 g1 ^) F! M ' F$ K, R( W# a- n$ s/ B0 IFetching concurrent-ruby 1.0.51 p8 R I; b/ M6 z
, B0 W0 A: W _0 N" E' G* H ^1 S7 s1 d7 n9 i# U9 @
5 |3 X* Q/ Y+ S' \- e0 G 恭喜您,这就是已经在正常安装依赖了! 0 b0 Y2 ]) q/ i' _9 N4 ?