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

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

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

[复制链接]
  • 打卡等级:暂无等级
  • 打卡总天数:316
  • 打卡月天数:26
  • 打卡总奖励:255
  • 最近打卡:2026-04-26 00:39:47
灌水成绩
17505
88
17992
主题
帖子
积分

等级头衔

ID : 1

管理员

积分成就 威望 : 9
贡献 : 9
下载币 : 372
在线时间 : 1506 小时
注册时间 : 2013-9-5
最后登录 : 2026-4-26

发表于 4 天前 | 显示全部楼层 |阅读模式
免责
安装 bundler 报错:1 T. C( ~$ v0 ]6 E! ^! v6 Z

% v0 S1 c. N/ p
" h" F# k) I( q# [% ?
; q. z; O( U1 f2 A; R+ ?1 E* K- YERROR: Could not find a valid gem 'bundler' (= 1.17.3), here is why:
/ n5 J( |1 M% d7 p5 P3 p

0 K2 W( p8 Q* l1 X5 O( E1 jUnable 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)) ^) J7 e0 A+ K/ B
" @" U1 ^) ^8 a% t0 ]
9 v1 O/ M% M7 c, \0 U

" }0 j! S) ^  i( r  f5 a6 ?1.添加国内源:+ q7 m8 J7 E5 j5 S% G1 |8 S% S: R; G

1 q8 |- C6 a# u* K7 J0 [: r' Y. D; f  p0 }+ J* L
8 T6 }% h3 z/ ~  ?1 N7 s
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/8 F) v8 h/ I8 @5 l
0 b- Q/ s6 v* ?! r! k- }- \6 {9 U2 v$ K

. z4 n4 ^" z5 D# z

8 S& x( G3 R) t" c0 m注意:如果之前自己瞎捣鼓已配置过源,建议先清理:4 H8 Z; B) w' }! [4 q- w: B

8 C: I9 x* H" O3 C, U; M3 D" i
$ v% e% `* n4 J# x9 m6 o- i" O) l% C& _+ _3 r
gem sources --remove https://rubygems.org/) z/ {" ^# I+ `+ d) V. n; P
) f2 E; h+ ?7 j5 [, _
gem sources --add https://gems.ruby-china.com/
, y. H, N5 J. U9 S" J2 B
6 Z/ k6 q( d4 |* n& ]5 u* Z

+ Z/ k4 ]  e3 v! |7 A
: I  F) f2 Q: u
2.验证当前源:1 A* u# y! I. T; X' O

; I! H) V) r! K1 i# \. ~" n) M) e4 O+ V2 x

/ L* U$ Z' m% R4 @, Z. Bgem sources -l
2 o! A$ Q: [% a0 i8 {# U
  T: p5 m  r" n, [* w: R

1 ~1 k' r7 O6 v; X

. L2 E7 C+ {1 }" c  u6 i1 j+ O& Y应该显示:
7 X! I! `- d" @' K' V6 a: d" `: [

4 c+ P- ?! Q$ R: r1 V
- N) Y+ r1 v; Y' d+ @# }# L*** CURRENT SOURCES ***# P0 @. N& V+ \8 g" f: O
8 X6 P" |* y1 S- Q4 a( d! |
https://gems.ruby-china.com/
2 V% h1 u. p4 U9 W7 @/ y) i

0 Z3 P3 t" }3 }& G- {

3 c* K5 ^2 C3 _, `  R* R- |
( \6 z  R% K2 B" }9 a
3.安装 bundler:' c* ^+ h: P' c4 L$ `0 F! p) `7 [0 n
8 r: N7 I; N, I1 `  |1 o; `
- T3 @5 F1 {; P+ n3 U# t6 H9 G
5 R; i, f* x; G. Q  ^
gem install bundler -v 1.17.3' Z5 Y! [+ {6 ]8 M9 X# T
' x' t( W' P, o+ q3 ?
' q8 m; |0 i0 j$ }) I, B$ t

* C% F4 N9 c: y9 v或离线安装(下载 .gem 文件):
' L; }9 Z' }" m: M( q  |# t
" z" _  R( k. l6 B  t
4 [- g% D0 W* R& \# |4 g, R4 T& g  B3 D) {/ Q, _
gem fetch bundler -v 1.17.3
( X8 K4 n8 O" [4 v& J# w4 j

3 ~5 b9 |8 p$ e7 D; N8 C
/ i) e1 t3 {& ?' R' K

% B. C+ R' W/ |: h本地安装:  \( r. k& W  t2 R0 s/ B

! K5 _$ A: \3 c$ A+ c
! H, D/ ?2 q: Y- v- V* D6 \# _; ~1 `0 u5 k9 w) A1 d% t/ `$ Z
gem install ./bundler-1.17.3.gem% ^! I1 g6 r9 G* t# f7 J
+ `" M( I! m/ b3 k7 {

' 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( |- A
0 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 M
9 `  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- X
7 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

$ J) W, V% F# ^6 ~/ [) l
' v# Y2 b+ X! Y! l% X% ]1 Wcd /home/root/dldl-gm && sh restart-alpha.sh- d) c8 M3 n! Q/ A
1 J3 b0 D* \- \" M* m
* r6 P+ L3 y9 X; \1 J

/ ]* j  K* v/ f应看到类似:3 t+ t# ]: Y4 i7 t- p# ~$ F) ~
7 L, T# }# T# ]) ?

! 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 r
0 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 S
7 s1 d7 n9 i# U9 @
5 |3 X* Q/ Y+ S' \- e0 G
恭喜您,这就是已经在正常安装依赖了!
0 b0 Y2 ]) q/ i' _9 N4 ?
免责
帖子地址打造全网最多免费游戏网站
今日来客 列表模式
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-4-27 00:25