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

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

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

[复制链接]
灌水成绩
19011
118
19588
主题
帖子
积分

等级头衔

ID : 1

管理员

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

发表于 2026-4-23 21:32:19 | 显示全部楼层 |阅读模式 IP:广东东莞
免责
安装 bundler 报错:5 W7 G. e- [0 N! I2 Q9 V

$ O' W" f% `2 v# ~( C! y/ K0 V# j- Q. i  D) x+ u. [
. |! X# E$ b2 C) e! ?, E5 H
ERROR: Could not find a valid gem 'bundler' (= 1.17.3), here is why:( x1 z4 ~2 p! J+ e- Y

# B% ~/ t# [. v. e8 }% }+ H! mUnable 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)
% y+ }6 z' N8 s

3 s+ N3 t# e8 R

; X9 S, ]. T7 `$ Y, z" t
8 o9 d& n1 j+ t. ~
1.添加国内源:
( x5 f8 g2 G& ]' C! E$ L
3 z; g5 p) }7 E- R% s% c* t
; _, P4 P0 ]& p+ Q# S: ?6 V# g
/ H. a. }3 m3 h  S: T4 @* Lgem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
0 r8 I* [5 \( i9 g2 \! F" O, w

; q6 q. ?: B' y! x; O' V

+ F/ `$ _, t4 K% B

) F2 {' a2 P( H8 m0 {- m注意:如果之前自己瞎捣鼓已配置过源,建议先清理:
* c: f4 i$ _7 r0 [
- q# N) a2 y) z3 s: f
3 q. m. X/ ]+ j& R, k$ O$ V& Y
gem sources --remove https://rubygems.org/
+ T. W( l( i' ^* r
8 S7 j( K3 M+ v! _9 N. A2 p. ]
gem sources --add https://gems.ruby-china.com/, m1 r7 D8 F& i' K& t

1 k- i# H/ v. p' v
# m* o8 S* {- h" Q; T

0 z8 I8 k; g& _+ _0 y9 Q, [2.验证当前源:
" x! A, C5 p8 I4 b' D* x8 u. e) L; u5 c. w5 i
; [$ T$ a) Z5 c7 g* T0 B

, r) ]- j; ?8 }) Dgem sources -l
" S7 D- q- X" l5 Q5 v

- G! p* F- H- r# e, M

/ f1 \+ B4 T7 t& A1 y' o

# }: r; i# U1 f: F应该显示:
: ^. F+ \. T' d. ?# E: h) d7 I, X/ n4 C* K# N& s  {
" \% P; R3 ^% [

- g# N2 V- A! l2 T*** CURRENT SOURCES ***
  `& n! I! `- A- s

& V" J- S- ]4 b8 @6 ?+ Phttps://gems.ruby-china.com/
" j6 T+ b: L) T1 I/ }1 f

1 S& X4 _3 L! V  {
+ N, b" }( w9 I- U  |% }% a! A

& J2 I& v% [1 B5 S: c$ u) g3.安装 bundler:; b5 w# S/ D- w

" r1 w& b6 K+ c
1 {% e9 ^7 A* J/ u
! p9 @: l$ t& t( E2 x- M: ygem install bundler -v 1.17.3
% [  L: p. g& S) M( ^
. u1 ?2 E7 c; K) K9 _

/ j) I! S: z! t; l3 H: I

" e0 ]# P6 |, P- H0 I或离线安装(下载 .gem 文件):
. n, O2 U( {& @* {2 s$ R6 B# B6 s& \" W6 n0 ~% P

3 O3 b  e/ j: M4 o) S, X( x5 o0 L  |+ }: M! M1 w+ q8 a/ q
gem fetch bundler -v 1.17.3
" G. u' I2 a; g& t3 j& s8 U( v& h

( ]" S, k; r/ a; Q% _

5 n# K! r0 p+ W

+ m9 c- E' v5 G  d4 k本地安装:
' t5 @& O* n6 L+ f& e9 u) K1 M& D+ o7 O

, M. Z" x7 f: d8 e. j- V
0 H9 B3 Y& [- o/ n. s/ e( [5 z: Tgem install ./bundler-1.17.3.gem. p' C1 H0 k4 X0 {" O0 E
* E/ Y' N- z" X; K, z
3 @" v0 A5 W5 f! J3 g, @
' u. F. y7 k5 ?6 h& b6 o4 z8 P
安装完成后运行:0 Y1 C+ U5 M- c. ]2 ^* {: Y
' B( @4 n5 R3 Y5 p: H4 Z8 ~

# L; Z9 T5 s6 h- x1 F- |1 d" |- r* i
9 n9 h; E' m  {- m6 A/ ubundle -v  l4 h1 C1 j! l5 g: T4 ~# F
: L' d) n6 J0 l( N: I

( {/ k! r+ c  i1 ?# q

- ~1 q. @+ r; Y! X5 \6 P! p应输出:3 E4 K+ B7 f5 d

0 F- ]5 G) D8 X- ]! Q# X+ O! ?: F" B" [( I) v! C# C, K. `
, y0 X/ U+ ]! ^/ y& d: L+ X
Bundler version 1.17.3" a6 m8 g- C! Q1 K7 V: r
+ W' u1 i" I" f1 w/ g# M8 ^

6 k7 Z" f! u* G

5 y2 `5 k% q+ b4 b$ v5 {9 t到这里环境已经安装成功!安装依赖并启动:2 [- m% N8 n6 c

/ {& p6 ?3 L- `" M2 j8 f5 T$ a* N: |8 _0 X2 R* U2 @
0 z" m4 A  Z' Y  h
cd /home/root/dldl-gm && sh restart-alpha.sh
7 h; n' K2 }4 ~. n& I  H
( o( p  ?; f$ W$ @

! J: q6 S% U/ d. l

/ I- G# ]* W$ M会报错如下:
& |, g2 {7 L* F6 e& {' W8 N) ]3 ^* Z1 {  T4 x: ^
- O9 Y4 w5 F6 G
: O& C$ J! C4 U- n& ]8 r
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
$ t/ M( L! e1 ?

3 a, w+ }8 D1 A  e; s; E6 ]5 {/ sapplication for all non-root users on this machine.( `3 \4 R3 J% N. K) Q

9 x- V; ^: ^: k. T1 v# `Fetching source index from http://rubygems.org/
$ l$ ?' `6 o9 G% m' ^
; }/ g- s1 q  p1 }4 r
0 l+ H/ g/ L' n, n  i0 |' S7 s! D
' u6 O0 X- t5 d2 @$ b
Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/
& E4 N% Q; O5 U7 @
* F& C7 I: m+ x; @# E2 P  m/ w+ p& q0 Y
Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/& E, [% r3 d, I7 ], _

, z' q. N! d" H2 K% F0 C# }

: W- v6 T, f% a7 S

, F# H% L& P0 u* M解决方案一:全局配置 Bundler 使用 Ruby China 镜像(HTTPS)
# c3 V' ]) ?* r- s0 z' W% ]6 O1 R' r7 d2 r0 w- J+ Z

9 E* z7 ~% t+ ~. p; d) z
6 X6 e" v- Q* x6 U( w* f- h' P) U  bbundle config set --global mirror.http://rubygems.org https://gems.ruby-china.com. ^, z/ {. r8 W. G: A* Q7 q; n7 G; M
$ X% @) B1 A8 d6 y5 I$ T% y4 A
bundle config set --global mirror.https://rubygems.org https://gems.ruby-china.com
, s$ z5 W( [, [

' Y9 d+ r- Y  ~0 y7 L" e# p" w
' d4 R+ W6 }9 r5 u0 d7 Z# g8 o( ~
/ J1 H! h; A. C7 y
验证配置:- `! }% y8 k! G( w& M7 e
. h% E% ~6 h8 d+ M# G; G
7 o$ B, k) ]+ U0 F. m- V
  O5 T5 {+ ~6 y5 X6 t1 ?
bundle config list
' P& I4 g+ Y; H
6 R$ s' N. z6 `/ \
7 O4 W+ W0 y5 D% z6 {  H

: h/ e  q  [6 i应看到类似:* u; O( T9 h! k+ l' c- m

" `/ }# {! l% ]" o/ f" V& N# ]# f+ k5 `
2 u  s* p/ X' ]
Settings are listed in order of priority. The top value will be used.3 H( ~6 F3 s2 O0 s# `

, R! R2 r6 j6 Amirror.http://rubygems.org
* m$ w% J! N. i. [$ @7 M3 C: l
# y* F- @4 j$ X: I6 p3 W! ?& e
Set via BUNDLE_MIRROR__HTTP://RUBYGEMS__ORG: "https://gems.ruby-china.com"  U, M& q+ L( ~9 J- ^  O0 P3 j

4 F: u) t5 d  Wmirror.https://rubygems.org
3 Z2 d5 n# M0 C7 g' u; I. {

- I: P, H! T# H# E" `/ K/ Q% [+ W) mSet via BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG: "https://gems.ruby-china.com"* q8 @2 ]; q# w3 y9 M
4 X/ }5 E$ H- Y7 C
7 b# C% H& n: e6 X8 M

; y% W5 O( _2 ^9 O5 Z) [这会把所有对 rubygems.org 的请求(无论 HTTP/HTTPS)都重定向到 https://gems.ruby-china.com解决方案二:
# Y# ]: E$ d0 Y" u) H. {- P$ ]  @) W2 J8 D
( n. ~7 t& [3 K" J# @
# I6 M; k% v, l! \: V6 d; a- `* y& y
打开:/home/root/dldl-gm/Gemfile和Gemfile.lock
/ I$ |0 X  F# z0 s$ U) N
7 S+ N; Z! ]) t% ^3 X6 Y7 s& [" P
+ B! H2 s2 k# `+ b3 K. ~

1 R& w' y* u, X/ T+ @6 N8 T9 \+ W% j' K  c! O0 ^

* p+ N( _: y6 Y( N7 O: A! J* M. H8 T) @6 a
' }5 ], V% v' [$ M
把文件里面的:http://rubygems.org/ 改为 https://gems.ruby-china.com/! M7 D: V  m; r1 w$ @6 R
7 r. I1 c# T( y( |
" i8 z# c+ v/ V' ]( K' f0 x
/ {# J8 j8 U/ ]: B' H: a. ~, T
重新安装依赖并启动:2 {% f$ H) z+ r5 x& T

5 H6 L; d) b' V6 i) L; j& O% N
6 i; O& q& }) z( {  ?  F' z- G; `1 }5 I
cd /home/root/dldl-gm && sh restart-alpha.sh! F- W% _3 s1 t, p: H
4 q% }% S2 q) a

3 n# h2 r3 D9 \, S0 p
& I# }: t- |7 k: Q' y
应看到类似:5 D8 o5 g; S: U

  l" K! _; u! _3 _0 T8 g
$ P2 Q* l# w/ P0 C9 V) _: v3 i; e3 c* W7 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
7 s7 a- l8 H# d! L
; X( `: b/ q7 s  I, P; F  ~& p
application for all non-root users on this machine.
7 D/ l9 g" C, U2 P
  j% {( o5 s, w/ t6 T$ y
Fetching gem metadata from https://gems.ruby-china.com/..........# n$ @2 ?3 y" N  s
9 @; K  o& o0 c, x$ w/ J7 a4 _6 H
Fetching rake 12.3.1
- M7 M9 F& A9 L

, z, v! l& U4 n: G$ qInstalling rake 12.3.1
: x; S, X* F' G6 ^0 |  p

$ V' ?$ B( K2 ]) |4 d8 GFetching concurrent-ruby 1.0.5
5 |$ z7 u% W, e# D( e* V

) o. `% I8 G* |" l  d5 q
9 x+ T3 J9 M) W
% {# H# Y  H, d; J/ U, i
恭喜您,这就是已经在正常安装依赖了!5 n7 _8 \$ `" D3 f7 {; k* C
免责
帖子地址打造全网最多免费游戏网站
今日来客 列表模式
本月有问题处理时间8:00-12:00上夜班  9.7发布
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-9-9 09:30

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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