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

 找回密码
 立即注册
搜索
查看: 8236

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

[复制链接]
灌水成绩
17837
95
18341
主题
帖子
积分

等级头衔

ID : 1

管理员

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

发表于 2026-4-23 21:32:19 | 显示全部楼层 |阅读模式
免责
安装 bundler 报错:+ P( d6 @/ j" B- `: m

7 [0 v6 k8 Y& T6 _1 j$ U1 ?# }1 m  d* v1 G# w) T1 I
0 }+ B* @" U* a3 `! x9 F: y% K
ERROR: Could not find a valid gem 'bundler' (= 1.17.3), here is why:4 F& A1 o( z( _* V4 @* ~' [
8 t. {+ x* {  t+ V" j
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); e- w0 u5 \/ S& H

, E3 }- e" M7 ~( D! P, s
1 l, ]  s8 U0 v, P9 |
) ^, R; F$ ?, N3 P# L
1.添加国内源:
' ~3 b1 r! ^0 U! H2 o4 H3 f$ Z, ~: \- ^$ ~4 z4 v) O# z: l- X
' @8 y: Z' s4 t0 ]3 P; c: ?
2 u$ J& {) P' ?. c; m9 ?" t$ }
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/, D# W$ I3 m. C5 }+ C/ U
, v; c! F! c, m" L

+ b7 E0 L$ C  _

% r' ?: W' }# ^  H: v; W* M- }注意:如果之前自己瞎捣鼓已配置过源,建议先清理:* v& j1 s) P) C" J; [1 q' S
! d4 [& A+ _) M) g1 z
+ u8 a8 {: |6 |
% G9 D$ f: k0 B! j- _9 g
gem sources --remove https://rubygems.org/" C0 J  m$ t" N; g

8 |# b) u" e8 [: `5 J  e. v: Zgem sources --add https://gems.ruby-china.com/7 ]5 o+ c. o" d) d8 }6 C
1 I5 [  H5 G- F$ Y  x

/ k1 d! ~% o1 K* D0 [$ O+ Y

0 K' P8 Y* y. x& B6 X2.验证当前源:
' E3 O8 m  j/ J8 \5 P; `
; C  u- q+ g3 T! {: s8 r% a1 g. m0 N! Q! z
8 [4 C# D( f& l3 ^" n
gem sources -l" Q5 K  ^; h2 l8 U& Q

" w! g4 g0 ^7 N+ N0 |
* S" I# ~) K2 U/ C/ u

+ i5 ~( |+ s7 h5 u" a; e应该显示:4 r" z5 Y4 m; C. p  L5 p% x: e
5 T; B1 p# ^7 I, Y; G. K

2 u: m3 y" K) |# X( Y. |( v0 a( {- q7 ]6 w' m& ?6 b
*** CURRENT SOURCES ***. {4 y1 l3 C/ m3 t+ T
9 {" S+ D$ A; k6 V9 }; M* z
https://gems.ruby-china.com/
( ^2 h4 z/ p. ?- J4 R
9 u, K+ |' e0 e0 r
/ G8 I6 `! O/ ~7 j" D7 L

# ~; x8 \# A1 Z3.安装 bundler:/ P- u9 j9 w% b" S" E0 y
1 i) b  i" n/ h8 o/ m
6 D$ B" H: L7 J
- o5 Z8 X/ N) J% D  n+ \4 ]
gem install bundler -v 1.17.3
: Y5 x8 Q/ }3 ^# J' C$ U8 a
) Z- W1 c. N: P" }% E9 s2 v
4 W3 _0 j" L' u5 x: {' }' G
" f, R7 u1 n* V% {; H. I
或离线安装(下载 .gem 文件):: y* N! a4 M7 n  m
( ?$ W) `% d2 c

: i5 e7 }* A7 K+ D3 x& \
- |1 ?5 H7 P$ H5 r2 s1 egem fetch bundler -v 1.17.3
. G& P8 Y% O) r0 y) S* e" q# O

, g4 L2 K( c4 H/ p2 K

  o3 Q$ T0 Q$ H7 {4 B( l

+ D# O. R" J2 e, E. u本地安装:4 {+ ~0 U9 T  m* P8 F/ x2 o

9 r3 b" S2 v& L2 o& k# J; T/ n7 r, [; d3 @% Q8 ^- d: G( `1 w6 f9 d* P

. k: k& L  c2 y7 Igem install ./bundler-1.17.3.gem
$ ]9 l; [. q. ^6 G

6 C5 E1 k6 C) j/ x- ~: I
" E5 ]1 @, K5 s, L$ }6 Y* L

% ^; \  t  ^+ U( ?安装完成后运行:! p" ^  N/ R: X- [7 c

  u; z. l$ A5 E6 e% ^- `$ r( N2 {9 O! r$ w  m6 {
; Z& v, l, U, p6 a$ B
bundle -v
# _8 U# o0 X" g6 T2 U

7 C4 _0 j' P* @3 z; y3 z# I1 M' f

4 ~9 j; A8 t( I! @6 J4 U
1 {# g- I6 b" o+ v6 S, a7 R
应输出:
9 X2 r6 p4 M3 G( j! |5 m# S+ L* ~$ q; D3 n( b
; d2 s$ J: U4 U* W+ s
/ ~3 E* J0 T& w( i
Bundler version 1.17.3' i1 P8 l& g0 b0 m5 A* o; ?
  h2 @7 X* S, Q& g0 v5 p  g2 X

4 |, H$ I+ l5 s" v" K

7 Y) O) b+ `7 }& c2 x, a; {到这里环境已经安装成功!安装依赖并启动:
: r: x6 p2 T& w" Y: X! y. ]5 W

. q3 h8 c7 D' [$ \  l5 _
0 K; a7 j" S8 j: jcd /home/root/dldl-gm && sh restart-alpha.sh6 z9 d) a0 D+ q( r/ f) p9 q# a3 G
3 I- g6 ?" W, E6 V
- l6 G. S$ h5 X8 G% Z# F0 C7 Y0 h

& Q6 n) x) R/ F/ t7 z会报错如下:) j1 R, k& _( [4 @
0 b$ N* K7 j' ]% H' @

# U: t- r% [9 _7 {3 s9 i
( v: I5 P! h6 K5 f4 ~Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this7 P# H9 O) t) m1 \
: v  X" i5 Y3 l4 r& y) e3 g, V
application for all non-root users on this machine.
7 n* ~- X( ?1 t3 Q1 h" }
; x% b& w3 o2 Y0 C
Fetching source index from http://rubygems.org/
7 e2 K+ h9 w0 A
0 e  w" S" \* h2 _' `

  [: n0 ^- {1 n0 Q

& e6 W. ?) x; y: LRetrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/
% n7 I+ B3 z1 O
; \/ J! h/ D9 W# ], l
Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/
, @/ j1 H; \0 i. \

& P8 M2 a$ t! {8 Y. _) u, V! z
1 v( Z+ d( R; p) v
: X( h; D" p" v
解决方案一:全局配置 Bundler 使用 Ruby China 镜像(HTTPS)
' @5 N' U+ ~, ^7 D  n9 b# o
2 B& b6 D) T: J. n
" y8 H4 L7 {4 ]/ y! b$ g3 r
% [7 C6 r$ [- g* Bbundle config set --global mirror.http://rubygems.org https://gems.ruby-china.com
/ u9 `7 o4 `' o% `# O, A, ^" B
* H7 R. g0 |: K. d& m0 ^
bundle config set --global mirror.https://rubygems.org https://gems.ruby-china.com
- j) r- F* A1 L' }+ h
2 P6 X8 H) O4 k0 O) d) |+ r# w+ D

5 Q% u& O9 W5 y4 }
$ o/ Y! P& x7 b! k; ^
验证配置:) t6 ]5 D  J! m2 Z

, ~  Q$ H! T) b+ m6 l. B6 Y, B$ z  k2 i3 M7 a% L0 i0 J7 ]+ m

: {  N8 N3 ^& Zbundle config list  V/ H+ }+ [" A* b9 k1 U

7 S9 L2 E; t3 q( Z
1 U0 W7 \# h9 c( r6 D4 f6 G5 g

7 e7 @) J/ ], t$ x  y+ M应看到类似:
& S+ O2 h2 {  [! M: c+ Y0 w, x
( Z3 t; ?) b9 Y' N. `) x! _, q- f( c+ W+ T* w$ r$ \; Z
- @# w2 `7 _  z8 D* |" h3 y
Settings are listed in order of priority. The top value will be used.
8 h( |) s0 G! `; D3 V) _
0 s- H: x5 a9 E2 k
mirror.http://rubygems.org
) E+ i4 |- ^, |- F8 u) o
* T& p9 K; _8 j. O7 u
Set via BUNDLE_MIRROR__HTTP://RUBYGEMS__ORG: "https://gems.ruby-china.com"
* }; t4 L, O. H. [4 i' G- i, l8 j
' p5 \: X+ u" t  d9 @! O
mirror.https://rubygems.org
( S+ ?6 i- W% v6 g4 Z- z

0 O' e& r9 r1 h+ ISet via BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG: "https://gems.ruby-china.com"+ A( S6 y- e. l' g& h1 U
1 `% X2 M+ }4 C) H0 ~0 E

) E0 b4 ^3 J7 S0 b. d4 s! \

1 d# t3 P4 A- o; V  y) `这会把所有对 rubygems.org 的请求(无论 HTTP/HTTPS)都重定向到 https://gems.ruby-china.com解决方案二:
4 V4 e# ^# k4 w- G3 a& f* b6 v9 c0 w+ R7 p+ e% p% n- t! a

" y( ]6 e& [# A6 J! q, r' o* o  |, H, q/ m: q
打开:/home/root/dldl-gm/Gemfile和Gemfile.lock  F2 v7 X$ a$ Q1 G+ s
/ q$ b4 B# F  h$ f
/ v2 v# }1 a6 I

: b+ r. T. q9 U; E4 k% G6 H
7 r# |! I0 H: E' ~- d$ P6 d3 c& b/ z6 O" Y& F

1 j: J1 X, `9 m9 k$ t% n4 {, A' G& |8 `5 s; a
把文件里面的:http://rubygems.org/ 改为 https://gems.ruby-china.com/9 x$ M$ ]8 p1 N( E& z

  |  I- u6 }9 h' [( X$ r. n
4 T! T4 s$ A" y

% T6 h; i# I: d& ?) T/ f重新安装依赖并启动:! O. P+ O6 B- z. {4 _" F

' p/ [! W: @* q( q& v
  f8 K6 ?5 F8 p% l2 ]
, w4 G2 b/ A+ F$ e* pcd /home/root/dldl-gm && sh restart-alpha.sh" O# B( q* J. A, n" ~# H
& [3 S( S; v+ B) l0 h, H0 G  V
) c/ O, D. t) A! V8 U9 ]

+ h0 ]7 `% F* [2 U3 n! |% W/ n应看到类似:- S* U6 M- m9 j! Z# W  g9 V$ M# p
* a2 [, B. `& q$ q& f; n

: f- M1 U/ z; ]5 t- C  Y( s$ m
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this, s# c0 y& c& H2 x: ]! u' k9 l

+ `2 T% J. r/ {3 e. I( iapplication for all non-root users on this machine.! P/ i% h* \6 G  D1 |; w( G5 e7 ~" i

* G. Z- H1 I' CFetching gem metadata from https://gems.ruby-china.com/..........' K! l9 F2 N. b
, M0 h7 Q) F: M0 u. K' e
Fetching rake 12.3.1' r" j! ?' @$ H2 R  c6 e1 o9 R
' z7 m% g2 D2 J# ~4 u& e' S
Installing rake 12.3.1
' t0 y* F! l' P# b- ]- h
3 s/ k/ j! x( p
Fetching concurrent-ruby 1.0.5
3 @# p5 L6 H( J/ H- h0 @. E* G

; j4 U4 i$ h. C' U5 @, ^2 ^. c

$ G; W- u$ S# U& T' M# Q

+ L2 l: d* n4 ~) ^+ `# U$ S3 M恭喜您,这就是已经在正常安装依赖了!
9 f  ?: j  w- Z# |9 J
免责
帖子地址打造全网最多免费游戏网站
今日来客 列表模式
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-6-11 03:51