设为首页收藏本站 国外访客:

 找回密码
 立即注册
搜索
查看: 14243|回复: 0

[教程/工具] 斗罗安装dldl-gm后台bundler环境和依赖报错解决方案

[复制链接]
灌水成绩
18541
100
19068
主题
帖子
积分

等级头衔

ID : 1

管理员

积分成就 威望 : 8
贡献 : 9
下载币 : 402
在线时间 : 1862 小时
注册时间 : 2013-9-5
最后登录 : 2026-8-2

发表于 2026-4-23 21:32:19 | 显示全部楼层 |阅读模式 IP:广东东莞
免责
安装 bundler 报错:
$ l/ u0 a% f/ `8 P9 y5 D3 [4 X& ]9 d# `7 s* x7 L
6 v+ J, ~4 r) V/ |

8 b4 i9 {, a9 m" ^* E: @ERROR: Could not find a valid gem 'bundler' (= 1.17.3), here is why:
  f/ T* p: ~4 S8 Y, U6 r

% a* h7 n# s1 A0 BUnable 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)
! I4 f  b2 V6 a9 v2 [

/ ~' X" L2 u" Q1 F. [, Q1 N, N
- ?  A5 ?6 I/ |+ D0 _! ^
0 J0 _' S* u- x/ @+ D( j8 T
1.添加国内源:2 k1 I0 T% J, j' i3 n
, Z; O3 A3 H# g( o  d9 e

7 A& v! U: |5 d  G' u- M
1 N" S6 R" d$ j) t1 Zgem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/7 x& T9 h! }2 ?% G4 t. A

9 q( R: ~* e1 ]' s# ~
3 h( ^( n8 Q& u" V4 h) [$ S

6 h7 V/ v: s' o, M注意:如果之前自己瞎捣鼓已配置过源,建议先清理:4 @) S. Q# |* Y# Z9 G( A) G! ~
8 f, ]  _9 R  f3 \2 \5 k* w
' w% Y: F. I/ t$ g

3 S% t0 N3 |) Z% s9 W% d- Xgem sources --remove https://rubygems.org/
  {5 V# I- R0 g3 \

$ `* P, D6 Y! s  q) Ugem sources --add https://gems.ruby-china.com/
  J  a$ @8 x- n* a' p2 }( X- G. S
5 e% J  y6 ?$ `3 O

. r# `( Z1 z! m$ G5 Q6 Z

. a* T! ~& x0 V$ E3 f3 v8 m" M2 z- C2.验证当前源:% n9 O# Y1 l1 N$ X! R

5 d8 |1 `7 B" y* c4 A3 K; b
& @; z7 T$ k4 F- f, I7 t
) Z& ^! ]5 |9 j* i6 F7 |; @' Agem sources -l, L+ ~& L* p& W% g5 g* X2 H
2 F4 I; l4 |( t( Q7 z% n

& ^! g! `1 l$ o  c1 W& v/ P5 L6 r

7 n6 v7 v# O7 K& m8 F8 P应该显示:+ _9 n6 F: f  I5 w

7 D; ~! J9 j8 W
3 F- `' ]$ l' P2 s! h9 B$ }
) f: H" I$ X# J! w! ]*** CURRENT SOURCES ***
4 s) S; R0 x+ N# q, E" a
' Y" M6 N8 w9 l* q. P& P9 O4 {
https://gems.ruby-china.com/7 e( B' v% l9 T5 Q  [6 e7 t
1 ~: e' g( p% K* }. R6 S3 N
; K9 \# N" L' G+ a

5 W; f) N4 s. d: h, _3.安装 bundler:
  h" e$ l$ B! D8 ]7 E" D$ r
& s, j$ ]7 i3 W9 n' X. ?  G
( c# m* N4 d; Q3 s5 D# B& G; ]  U5 l0 x, x9 Q. ?
gem install bundler -v 1.17.3
+ ?8 T: y( J& ~4 [2 [: r

3 l( n: M/ y1 G' s; M  f

" j7 p' v+ N! d& a4 T0 U" B
/ C" Z3 z, \: _) w7 [6 f7 H
或离线安装(下载 .gem 文件):
( \0 U. X/ s7 A- Z( T  y
. ^, g; W# P! D' m( u# `- L
  ?& H9 N6 k- t2 U  v, X" S0 \  e* C0 q! O. m
gem fetch bundler -v 1.17.3: R; T. z# z( W9 T
# O5 b; L. N: Y1 O# z

+ }; F; y! `1 L

) }2 C6 t9 z( F4 y本地安装:( k$ ~" U' F% \! @) t7 A) {" k- L
- l& w) b, X8 s1 Z5 a& C( `8 r

" q: x) g! D! S5 e; |+ Z6 g" C  ~/ F6 z& z. e$ H
gem install ./bundler-1.17.3.gem
2 l; T6 O9 j, x9 M
" K5 K( ~  x$ o4 [) d. w* ?: d
: ~2 f/ ?/ A" \3 `

$ L# A3 F) s! e* w( B' ~5 q安装完成后运行:9 t! y+ g& y$ Z2 q, W& E. |

; C3 M: e8 H8 l' z3 g3 }" v5 |2 x, k/ q$ t+ O0 N

/ I8 D! p6 n- x% |6 E0 K5 lbundle -v
) x) u! r. X5 g+ o
1 h: D, w; o3 p$ m8 j; v
+ E& D/ _( x6 T) N

' |7 c$ \; w+ d: }0 ^4 e应输出:; N  N. o2 \4 Y0 ^2 Y0 P+ x6 m6 K' e

$ v* s" l/ Y" O( z+ ~; o* e# Z9 Q! Z' C. C4 `) |
. {) d" P$ b& U, x) j
Bundler version 1.17.3+ k* K- U" U0 B1 \% C% J
$ @7 E" W4 `/ Z& Q" t, ~# b
) l- _# P: q4 R/ N; A" D* f* f
$ E; ~/ X2 V: ?0 b, p. P
到这里环境已经安装成功!安装依赖并启动:4 {! R! }( r) @3 a, n- Y( C

! p, e1 i7 y- V- M) e! g( J$ n1 G
6 W9 M  V5 M6 a5 @# K+ M$ c& n' W* t
cd /home/root/dldl-gm && sh restart-alpha.sh
" ~1 Q+ J" V+ R! F

' G6 ?  ?! B7 O4 m2 U
# z/ C  S, h5 t% z- z
4 d2 G3 {7 e9 i( X0 z
会报错如下:
! C- O( N& _, I. u/ F/ M; ~8 M% l3 o6 q. n$ W7 t

' S% P  ], q1 K
8 A8 T) ~! a8 ]Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
! o2 w9 p# D. Y% r( k5 j$ o9 H1 |
( y- |( u( ]$ a- U8 \
application for all non-root users on this machine.
7 u7 o: b  k9 b7 ?; Q
" l( K' Y0 X6 r3 p0 ], z$ l
Fetching source index from http://rubygems.org/
2 K# V" p+ p) h) \; X+ Y* g& f* F
9 s7 C& k8 z" {( |( N
9 V0 Y* w) w5 T! H* ?- E$ N

) J4 r# v% a; `* ~2 n' d( ~Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/9 g  y* o. [& `  j! Y- D. H8 Y
- _1 b2 X" T* t& D
Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/2 E" R2 B% L3 z' M, W5 i. w( H

& j/ W( ]8 T" D; T/ X
. X. @. q5 b5 t% [$ ?' u9 f1 |

! N4 Y$ X: }5 T) l: p+ r解决方案一:全局配置 Bundler 使用 Ruby China 镜像(HTTPS)) c2 \! ^) Z% L# V
+ ]# l$ F" _! P& z# u+ P) M

: n' I( E0 A5 y, m% h3 m
7 l% }8 P9 N: l. C0 pbundle config set --global mirror.http://rubygems.org https://gems.ruby-china.com
7 P* c! F  g# A9 D- m0 R4 q
, r& B- R" d! G0 i6 T# F2 R/ X! k
bundle config set --global mirror.https://rubygems.org https://gems.ruby-china.com& ^/ t3 H4 L1 Q- ~

5 K5 V9 F$ e" o5 P* g  [5 @

0 d, T4 t, l- D9 G) h# O# @
% B3 C' a1 x. O: X; @
验证配置:
. g! g/ }" k- ?
6 q5 J8 ]" i, z! g: }, V
' k# O2 i* s' b2 `
( d; j8 J; {! V6 J6 ^  {bundle config list
% s' k9 Y. t' _" @9 M

" L9 \* Z. z9 v

0 f1 O1 n; F1 Z+ w
7 P" M9 `$ C* O3 {- e$ L
应看到类似:
% X" E& w# Y5 X+ g3 b8 Z/ p8 S$ n. L. s0 D. O$ \4 e( @

" H) A$ f, W& t" P- S1 m0 H- a/ L
Settings are listed in order of priority. The top value will be used." A4 n8 n; ~! Y, q4 q
7 E* Z. o. B: Q% [7 m& w
mirror.http://rubygems.org0 v  @! a0 [( L. ^

. b6 n& t: Z8 P+ m% {* A  GSet via BUNDLE_MIRROR__HTTP://RUBYGEMS__ORG: "https://gems.ruby-china.com"
# [2 V8 A3 }3 j# t: _" Y) |

% q$ }: G  I: U4 e' v5 Fmirror.https://rubygems.org5 r. h: l' g' n9 x( I

6 }) w; @0 x8 `8 Z2 ?% M. vSet via BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG: "https://gems.ruby-china.com"
' U3 H, c9 m  E7 P

* e% u' S7 r' V
. N7 a* S, b8 F/ P. R
: n) k( c! V8 S# M: s8 J
这会把所有对 rubygems.org 的请求(无论 HTTP/HTTPS)都重定向到 https://gems.ruby-china.com解决方案二:
/ Y2 P+ E: K8 Y/ I! @6 b& m; m# o* `% K2 P, h) @( m* ]
; c& h+ ^# S6 L. b" x
# G4 ]: R9 s, e1 w9 ?6 `) Q
打开:/home/root/dldl-gm/Gemfile和Gemfile.lock6 u# ~0 D  ?3 G1 {1 w
7 p9 F8 @0 p* A6 r4 Q
+ h& P0 U2 s' `5 K3 H" {6 C* e

+ w8 n% _, @; t; U8 }
2 c* g; X) L9 `, y( W3 B* y+ x
* ^6 p/ o& b3 x, A1 [, I7 M1 F  S0 c/ t

4 M& O* N: V& f3 V) g把文件里面的:http://rubygems.org/ 改为 https://gems.ruby-china.com/
3 x5 X# Q; b' u
- _: Z5 B* [1 ~, k
0 z+ Y3 u6 ~+ G4 b
1 x- }1 V1 G  Q
重新安装依赖并启动:% Y$ ~+ y  C* D  }
" K$ ^  p4 i# t( I. A3 e2 U* n

. {5 u+ t4 n' A* c+ x2 Z. `$ d9 k4 m% z, A( m" T
cd /home/root/dldl-gm && sh restart-alpha.sh
+ [. b$ e3 r7 [; G+ r# ^

# c2 F0 p1 j, J: x! g6 U) X4 H
+ g  X( `2 J) e* {

& w" s$ y1 ^; ^9 q/ m1 |# z应看到类似:
' W0 N# G/ k5 p  L) k7 i, j1 i0 r( `4 }: x) ]

' Q" x' r; M: v* z2 P! G  U( }8 \2 B! p: e6 ~1 m
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this3 V4 s0 L: n7 ^  h* f4 F$ H+ ]
6 t  v9 U1 I- @
application for all non-root users on this machine.
5 k, }( Y# ?+ Z9 p- A2 f5 |! ?

9 m, u7 R0 q% v, P0 T9 _- Y# VFetching gem metadata from https://gems.ruby-china.com/..........6 [  H! Z1 f& U1 W1 s( |
) u/ E$ \6 q, N, z) ]8 d
Fetching rake 12.3.1" W- @6 J# C7 Y" I
+ F/ k- _' l6 h7 M5 ^# V
Installing rake 12.3.1
0 \' n) q' H1 X! d9 t5 V( F) Z

4 N* Z! L5 [) q8 q2 ?7 V. ^; LFetching concurrent-ruby 1.0.5/ ~8 Y' v9 Z1 l, U( j& L
( J. O2 F" i/ c# a' [) j

8 n; B& d3 O( ?1 U, f; w, ?
; g6 v3 G1 U, _& |7 k3 u+ s
恭喜您,这就是已经在正常安装依赖了!
/ w0 J# {  {$ V+ U) K
免责
帖子地址打造全网最多免费游戏网站
今日来客 列表模式
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|蔡州手游 |网站地图 wapmz.com

GMT+8, 2026-8-2 12:35

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表