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

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

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

[复制链接]
灌水成绩
19649
120
20243
主题
帖子
积分

等级头衔

ID : 1

管理员

积分成就 威望 : 8 点
贡献 : 9 次
下载币 : 449 枚
在线时间 : 2005 小时
注册时间 : 2013-9-5
最后登录 : 2026-10-25

发表于 2026-4-23 21:32:19 | 显示全部楼层 |阅读模式 IP:广东东莞
免责
安装 bundler 报错:1 ^" X( z7 F$ k

( H. |9 }, P% N9 a1 t6 L0 p1 X4 r: z
9 q% Y  h9 a5 n2 N4 `( u
+ L, _; Y, _' s: ?1 @+ t- S6 JERROR: Could not find a valid gem 'bundler' (= 1.17.3), here is why:! o+ y6 Q9 J( G* }& B
4 k  b0 I/ s( G; Z! H" S6 Z* N
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)' D2 n% q8 c, Z0 Y: l
8 k  c) I; o! |; R! q7 A( L

; _) l- G" _2 c; ^/ a; N% ]
  q5 g, q! t; r9 s" H
1.添加国内源:
9 _; e7 \( b3 G6 F: _* y# ~! }  a& z) Q" x* l

5 N: t# S& D, q+ |0 j+ C. ~8 h6 E2 [, O* A3 p. o, I( `* a
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
$ Q2 ]- `6 E' e# R$ @- b

7 {! y3 `) T% T+ |

' S2 ?( A: }% ], @3 ~

* H4 T" x) M0 X4 Y: y8 T注意:如果之前自己瞎捣鼓已配置过源,建议先清理:
# q' ?' T* ?* p. K" E! Y! \! {
9 J/ C+ ^0 K% A7 W* A9 k  ~2 N' m! _# K' L2 d  L' F  \% g2 |' \$ Z
  P) |9 m! D5 q9 B6 c; J
gem sources --remove https://rubygems.org/! I! ?3 a# O7 g5 d6 q

  s  y; u& A4 l  Y7 y/ n7 _gem sources --add https://gems.ruby-china.com/( a8 F# n" W9 n1 R6 X# M
# R5 t9 o. h' \9 E$ ~0 ^9 U. |

, E# T. Y  K7 d+ `: X9 X8 g

% D, |5 r1 e* _3 d3 P4 s2.验证当前源:: n3 s9 Z9 Z7 f# Z' j7 w

9 ?5 `: Z/ N2 y. j
' j5 L6 U) X# a, s5 Y1 c8 \- D0 N# p- |- Z( N# Y
gem sources -l) c: ^0 k/ p$ y/ z1 |
/ W: E4 o# a% j* O& X
- D4 S0 t9 X: w8 ]/ l6 f6 |9 `

9 F% [) C& l! q' T. Z, {2 I应该显示:
: P/ E* p/ ^0 K% [8 U. Q
# \) R& E% ]: h, `+ s  g
0 H) X1 |$ U# J4 `
: P8 D& i7 U# w/ h0 @*** CURRENT SOURCES ***) ]2 ~# ?3 J. |& \

3 ]$ {9 _' O& Fhttps://gems.ruby-china.com/6 }5 S' o, D  Z# z. B

" ]( P# H" F+ D) w4 y
( j' }: e# i2 ~. l1 s$ w& x

: J- h; F: I% f/ b: d$ `! t6 @3.安装 bundler:
  W: Q$ I( }# C" c! O% h$ N! O  X7 N! ]
& o7 [. Z5 q- Q" C$ x  X8 L5 v
. V: V# P! c; `" J$ s: N. w$ q& L' ]0 l7 }/ U% H& a8 _
gem install bundler -v 1.17.35 G% O7 L- B+ K) _; A
' @. y# _' j8 k6 Y8 z' b" w
6 ^: U' f& {% }! @  M' r: D
- `0 E- q" T- S/ P
或离线安装(下载 .gem 文件):3 c1 D% V& l9 F7 u. Y, C
4 @% t4 ]5 k  Z1 {+ F
" i9 x4 l8 q5 K8 L3 E  p
7 |7 c# G- S; Q% d$ r" b
gem fetch bundler -v 1.17.3
7 G, t* T$ Z/ {5 |# p1 j' E
* U- H& @2 H; F! ~  s

. `% {4 ?* @* j% R/ Q  v
* |) A3 v$ V& N% B9 Y4 J
本地安装:! I) [$ D7 ^7 ]1 `
, h/ K) O% o; K  \0 C, s% z
. |/ F+ A! ?4 C9 Z3 k3 H- n

) u/ `) v& {3 W6 S$ Hgem install ./bundler-1.17.3.gem7 I& M. e0 E% y8 @

1 y' m& O4 V/ f

' F4 T& D# n9 z2 |5 W7 K/ ]5 K1 z
5 {- |! t( `$ f1 ]$ b
安装完成后运行:
$ j1 j& w; x# _* e8 }0 E4 ^2 w. f- i9 h+ B" y; K4 y) V$ [
% T% ]) K2 C! E5 ]9 ^) }

0 Z3 x- f- m& l% B2 sbundle -v- Q! \/ h1 J3 I7 A/ w1 @

5 u. A2 }% _1 X6 k" }
5 R/ {2 e' o/ T& Z0 k, Y) m/ d
" [6 T9 s$ P' {' g" h
应输出:
8 v: M. z1 M2 g* r
6 @2 q- i; {! ?! K
9 X( U2 X( t! L+ q( r
5 o" R. M; v( M! S6 j! tBundler version 1.17.3
5 ]" |9 w, D3 \2 c

' |) z3 l- s' X0 I* A, h, T
1 s- I- W% q/ N) p* r3 \

& T$ {$ u3 n' e; c4 h) j4 F到这里环境已经安装成功!安装依赖并启动:
5 j2 L5 ~3 }  c  U( l) r& m# J' |+ @8 j

, ^2 \9 x3 F, T9 ~) n! c
! n( v: C3 Y3 Y0 O/ T, s6 P7 E0 N, j5 m' rcd /home/root/dldl-gm && sh restart-alpha.sh# B1 |9 D+ t1 T6 @) n

  g6 d. T; }& E( c8 l9 i8 J
& w3 _8 T0 E( u
. y, J- j1 y- p" u: Z, C
会报错如下:. H' V" S9 b  A9 f# z  ^
2 x. O2 U9 X' f; u- e( }" @

% J7 m* g0 ^" d% s; Y9 Y  }
3 `6 j: P$ E5 c; u1 IDon't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this- T, @3 F4 y; F% r2 e9 ?

; R/ q* E8 a5 ~application for all non-root users on this machine.- U, E' `' r! j9 }: |" J2 t
: x$ E0 v2 H9 E+ q4 Q0 i
Fetching source index from http://rubygems.org/& E' H, E) [$ D6 N

8 T. G( x$ A. v; A
) _0 `3 O7 j6 |
0 ]8 _5 g5 \7 ?- }4 ^1 V
Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/3 {) q6 z1 o! I  p7 J( S; t  M
' b7 N/ N. K9 d4 a: |2 E- e
Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from http://rubygems.org/
' a1 R, ~: `  j6 R, K

! x+ L, j! ~9 C9 `: Y6 ?

' n! h: c% g1 ^: `1 d' [  b1 f: P
3 C. ~; \. N$ v! T" D
解决方案一:全局配置 Bundler 使用 Ruby China 镜像(HTTPS)& `  Z2 ?1 y; T8 n

7 S' o+ J" q% C
7 E1 ~7 g* M9 `, r( O3 B  `; W
bundle config set --global mirror.http://rubygems.org https://gems.ruby-china.com6 E* s4 s: v0 h! O. Q

4 L. |- @0 @, t8 \* b, D3 W/ ebundle config set --global mirror.https://rubygems.org https://gems.ruby-china.com
+ Y. e% g! J# Q2 c; D
: }$ J* K# j, z) u
- A' g  {" U( w" l4 |
! L; [' e! c3 m7 f
验证配置:
: [# A" Y  h' Q4 @0 H8 G( c: u+ b; h, [& i0 K2 ^4 E" H- K
9 M7 d+ L: s6 y" k9 Q4 b+ H

8 o" u$ ^, q" i8 obundle config list* k6 y% \+ k0 f' ^
$ X( z0 V2 T& z5 t. `1 f5 E" P
! K+ d$ d5 X1 U5 i

" }' _6 `- h, D7 k' u# B5 _: r. l应看到类似:% Q: T: k! r. g9 o: O$ c0 u

6 e; q9 W! H- ^3 _7 [1 T
; Z: b. o* F2 v9 i9 J& O5 \
6 K2 \) ]/ b: `$ b: sSettings are listed in order of priority. The top value will be used.
" U) P& S( {( {

& y$ n$ {: @, b, w; c7 k0 [3 V+ B2 pmirror.http://rubygems.org( E( Z- f) a% W( c/ J& X/ p
1 h; }1 v  _, z9 y$ L2 R8 H
Set via BUNDLE_MIRROR__HTTP://RUBYGEMS__ORG: "https://gems.ruby-china.com"; J; e/ H4 q2 n4 K4 ^0 }: l, M" o
. d8 E. I* c$ A- J
mirror.https://rubygems.org
8 D! O; h* L# O$ N0 a; W
+ ?5 X0 u, ~5 O. d. H. _
Set via BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG: "https://gems.ruby-china.com"
/ e1 B" Z+ ~3 t

, b5 _. d, E- O' O7 c: V
2 E' ^+ j& J2 S; g
- ?- Q+ o5 m1 k$ n: y( i
这会把所有对 rubygems.org 的请求(无论 HTTP/HTTPS)都重定向到 https://gems.ruby-china.com解决方案二:
+ H# `! y2 r2 z  C$ L1 I* a- P4 V* R: i  [- i/ s

: ~7 A( S( _& r' [9 j* v# x
, ?( j4 V/ r& a$ D5 L打开:/home/root/dldl-gm/Gemfile和Gemfile.lock
. V. M, m% r; S7 E1 H
/ i; n0 U& k; B$ h6 G, ?

2 V: v! z. S& Y& e3 i0 [& X

, d* j! k  y4 ^2 i1 i
. ~7 d6 d8 b& Z, y/ ^
0 i+ q$ y3 e3 Z! }9 @8 X6 O+ Z9 w. s1 e. q% N0 d9 x6 ~

1 ?0 Y- u% z! R) h9 U" c. X9 E把文件里面的:http://rubygems.org/ 改为 https://gems.ruby-china.com/
3 U# c( f. i2 m

6 c+ F2 |7 [: u$ ]3 O
6 k! x; ?% u8 t

4 p( E# f+ q6 J3 E# G2 G重新安装依赖并启动:
) O: b# v* i7 i! D2 w$ [9 Y6 O% v3 n6 {) {0 w- W

8 m" @- ]: B/ @. L/ h- P" h) f7 A% F. X6 y+ v5 d# g+ L1 a
cd /home/root/dldl-gm && sh restart-alpha.sh
$ |" O) `0 Q. S/ V! J  o
0 `& v; r" N# B3 q

8 [- @! Z5 J( G( o$ ]/ z" v7 f  K
! i9 o1 O# M3 g& e1 q
应看到类似:
5 K7 D# w: x( w+ t) n/ ^1 e/ g( w: `. W3 p: r( A2 X- j

- G) T0 `. `3 G* h/ s1 W+ |+ j, K8 k7 C. g- P
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this2 q) m/ Y3 m: I) t" C

9 J4 S7 S' a. ~. K, O3 yapplication for all non-root users on this machine., d. J  q! v: J6 l) ?5 N/ Q1 M

. h* N/ e' c. O; h8 |  ~! RFetching gem metadata from https://gems.ruby-china.com/..........0 `2 [9 }6 P: [( x" o

0 ^/ u) p: _( qFetching rake 12.3.1
  _! |  L! y5 I) O/ x

  y* G# L/ e* ZInstalling rake 12.3.1
. |. A" c) u: n/ }% F. p7 ?

- ?' P2 I0 Y: M  h, E6 z4 D& Y9 E5 E/ ^Fetching concurrent-ruby 1.0.5
- c$ t7 z* N5 L/ G

9 f. j* A, j# Z6 `0 f9 F7 Y) Y9 R+ v
6 a2 e+ M) P/ x8 M* J1 F. `
+ J1 ]8 H2 c9 B3 P1 V: O. G
恭喜您,这就是已经在正常安装依赖了!
/ d+ ?4 X% S7 I4 K4 h( J: n( F4 |
免责
帖子地址 打造全网最多免费游戏网站,部分资源失效,私聊站长补
今日访客 列表模式
10月上白班,问题处理时间等晚上
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-10-25 11:18

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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