V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  fenglala  ›  全部回复第 4 页 / 共 5 页
回复总数  85
1  2  3  4  5  
2020-02-05 11:23:24 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@learnshare 我找到了一个百分百不丢包的 ip 140.82.114.3 刚才重启换上之后,确保直连能打开 github,然后还是卡在这一步。刚才回复不了,v2ex 说我回复太多不正常,让我 1800 秒之后再回复
2020-02-05 10:50:21 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@learnshare @francis59 谢谢各位的回复!
2020-02-05 10:49:19 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@learnshare @francis59 你俩的方法我分开尝试的,没有混淆。
用 @learnshare 的方法 1 ALL_PROXY 没用
用 @learnshare 的方法 2 host github 还是没用
用 @francis59 的方法 3 换成淘宝的源,确实换成淘宝的源了但是这玩意还是要连接 github 连不上

现在我打算整个跟 win 下的 sstap 类似的那种东西,把整个系统的所有流量都走代理,找到了个项目现在试试

https://github.com/semigodking/redsocks
2020-02-05 10:40:12 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@francis59 不行,我把 bashrc 里的全都删了,npmrc 里边剩一行 registry=http 淘宝链接。。。。gistry.npm.taobao.org V2EX 说我每个回复都有 url 看起来像发广告的。。。。
执行的时候前边前边明显快多了说明淘宝的源用上了,但是还是卡在同样的地方
lala@ubu:~/projects/electron 10:35:53
$ npm install --save-dev electron
。。。。。。。。省略省略。。。。。。

> [email protected] postinstall /home/lala/projects/electron/node_modules/electron
> node install.js
2020-02-05 10:36:32 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@learnshare 不行,还是卡在这
2020-02-05 10:30:14 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@learnshare 改完重启了,现在正在执行你说的那个命令,我也不确定这个丢包率能不能连接成功

lala@ubu:~/projects/electron/my-app 10:27:45
$ ping github.com
PING github.com (140.82.113.4) 56(84) bytes of data.
64 bytes from github.com (140.82.113.4): icmp_seq=2 ttl=49 time=262 ms
^C
--- github.com ping statistics ---
5 packets transmitted, 1 received, 80% packet loss, time 48ms
rtt min/avg/max/mdev = 262.334/262.334/262.334/0.000 ms
lala@ubu:~/projects/electron/my-app 10:28:01
$ ping github.com
PING github.com (140.82.113.4) 56(84) bytes of data.
64 bytes from github.com (140.82.113.4): icmp_seq=1 ttl=49 time=290 ms
64 bytes from github.com (140.82.113.4): icmp_seq=4 ttl=49 time=261 ms
64 bytes from github.com (140.82.113.4): icmp_seq=5 ttl=49 time=336 ms
64 bytes from github.com (140.82.113.4): icmp_seq=6 ttl=49 time=268 ms
64 bytes from github.com (140.82.113.4): icmp_seq=8 ttl=49 time=377 ms
64 bytes from github.com (140.82.113.4): icmp_seq=9 ttl=49 time=274 ms
^C
--- github.com ping statistics ---
9 packets transmitted, 6 received, 33.3333% packet loss, time 91ms
rtt min/avg/max/mdev = 261.054/300.962/377.263/41.984 ms

目前还是卡在
> [email protected] postinstall /home/lala/projects/electron/my-app/node_modules/electron
> node install.js
我再等一会再看看
2020-02-05 10:24:22 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@learnshare 我感觉不是被污染的地址,因为我是通过直接把 IP 敲到 chrome 地址栏,然后跳转到 github 的。我试一下你说的 hosts 的方法。
2020-02-05 10:23:13 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@francis59 试了淘宝 cnpm 也是卡在一样的地方
2020-02-05 10:20:52 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@learnshare 谢谢一直帮忙。他这是不是从头到尾设置的代理都没生效过啊,还是说安装依赖的时候代理生效了,就连接时候没走代理呢?
2020-02-05 10:17:16 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@learnshare 现在指示删掉了 bashrc 里的那些,npmrc 里边还剩如下:
lala@ubu:~/projects/electron/my-app 10:13:56
$ cat ~/.npmrc
noproxy=localhost,127.0.0.1,192.168.,10.
strict-ssl=false
global.GLOBAL_AGENT=true
global.GLOBAL_AGENT.HTTP_PROXY=http://127.0.0.1:8123/
global.GLOBAL_AGENT.HTTPS_PROXY=http://127.0.0.1:8123/
registry=https://registry.npm.taobao.org

执行 ALL_PROXY=http://127.0.0.1:8123 npm install --loglevel silly 的时候没有任何问题,一切正常。

但是执行 ALL_PROXY=http://127.0.0.1:8123 npm install --loglevel silly --save-dev electron 还是报那个错,最终结果显示出来还是安装完成,中间日志如下:

npm sill postinstall [email protected]
npm info lifecycle [email protected]~postinstall: [email protected]
npm sill postinstall @electron/[email protected]
npm info lifecycle @electron/[email protected]~postinstall: @electron/[email protected]
npm sill postinstall [email protected]
npm info lifecycle [email protected]~postinstall: [email protected]
npm sill postinstall [email protected]
npm info lifecycle [email protected]~postinstall: [email protected]
npm sill postinstall [email protected]
npm info lifecycle [email protected]~postinstall: [email protected]

> [email protected] postinstall /home/lala/projects/electron/my-app/node_modules/electron
> node install.js

(node:11541) UnhandledPromiseRejectionWarning: RequestError: connect ETIMEDOUT 13.250.177.223:443
at ClientRequest.<anonymous> (/home/lala/projects/electron/my-app/node_modules/got/source/request-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:313:26)
at ClientRequest.emit (events.js:228:7)
at ClientRequest.origin.emit (/home/lala/projects/electron/my-app/node_modules/@szmarczak/http-timer/source/index.js:37:11)
at TLSSocket.socketErrorListener (_http_client.js:406:9)
at TLSSocket.emit (events.js:223:5)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
(node:11541) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11541) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
npm verb lifecycle [email protected]~postinstall: unsafe-perm in lifecycle true
npm verb lifecycle [email protected]~postinstall: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/lala/projects/electron/my-app/node_modules/electron/node_modules/.bin:/home/lala/projects/electron/my-app/node_modules/.bin:/home/lala/.local/bin:/home/lala/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
npm verb lifecycle [email protected]~postinstall: CWD: /home/lala/projects/electron/my-app/node_modules/electron
npm sill lifecycle [email protected]~postinstall: Args: [ '-c', 'node install.js' ]
npm sill lifecycle [email protected]~postinstall: Returned: code: 0 signal: null
npm timing action:postinstall Completed in 31826ms
npm verb unlock done using /home/lala/.npm/_locks/staging-7ae29a0b4c2104a4.lock for /home/lala/projects/electron/my-app/node_modules/.staging
npm timing stage:executeActions Completed in 33034ms

最底部日志如下:

npm sill install saveToDependencies
npm verb saving [ { name: 'electron', spec: '^8.0.0', save: 'devDependencies' } ]
npm verb shrinkwrap skipping write for package.json because there were no changes.
npm info lifecycle undefined~preshrinkwrap: undefined
npm info lifecycle undefined~shrinkwrap: undefined
npm info lifecycle undefined~postshrinkwrap: undefined
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm sill install printInstalled
+ [email protected]
updated 57 packages in 37.468s

2 packages are looking for funding
run `npm fund` for details

npm verb exit [ 0, true ]
npm timing npm Completed in 37893ms
npm info ok
2020-02-05 10:11:40 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@kumiko 好多软件设置可选代理,但是好多软件的代理都不生效就很烦人
2020-02-05 09:53:53 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@learnshare 多谢你的建议!

现在我的 bashrc 和 npmrc 如下

lala@ubu:~/projects/electron/my-app 09:49:34
$ cat ~/.npmrc
proxy=http://127.0.0.1:8123/
http-proxy=http://127.0.0.1:8123/
https-proxy=http://127.0.0.1:8123/
noproxy=localhost,127.0.0.1,192.168.,10.
strict-ssl=false
global.GLOBAL_AGENT=true
global.GLOBAL_AGENT.HTTP_PROXY=http://127.0.0.1:8123/
global.GLOBAL_AGENT.HTTPS_PROXY=http://127.0.0.1:8123/
lala@ubu:~/projects/electron/my-app 09:49:41
$ tail -n 10 ~/.bashrc

export ANDROID_HOME=/home/lala/AndroidSDK
export HTTP_PROXY=http://127.0.0.1:8123/
export HTTPS_PROXY=http://127.0.0.1:8123/
export http_proxy=http://127.0.0.1:8123/
export https_proxy=http://127.0.0.1:8123/
export GLOBAL_AGENT_HTTP_PROXY=http://127.0.0.1:8123/
export GLOBAL_AGENT_HTTPS_PROXY=http://127.0.0.1:8123/
export ELECTRON_GET_USE_PROXY=true
export ELECTRON_MIRROR="https://cdn.npm.taobao.org/dist/electron/"

但是还是卡在这个地方。但是另一方面这个 electron 依赖看起来已经下载下来了
lala@ubu:~/projects/electron/my-app/node_modules/electron 09:50:52
$ tree .
.
├── cli.js
├── electron.d.ts
├── index.js
├── install.js
├── LICENSE
├── package.json
└── README.md

0 directories, 7 files
lala@ubu:~/projects/electron/my-app/node_modules/electron 09:51:10
$ wc electron.d.ts
13622 61347 541692 electron.d.ts

所以要解决的这个问题应该不是下载依赖,而是如何解决连接问题。
2020-02-05 09:48:48 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@francis59 我试一下,多谢!搞完回复
2020-02-05 09:48:11 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@zjq123 用 polipo 将 socks5 代理转换成的 http 代理
2020-02-05 09:30:15 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@learnshare 好的我再试一下,多谢!完事了回复你。
2020-02-05 09:22:38 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@learnshare 还是不行,错误一样

```
lala@ubu:~/projects/electron/my-app 09:20:18
$ ALL_PROXY=http://127.0.0.1:8123 npm install --save-dev electron

> [email protected] postinstall /home/lala/projects/electron/my-app/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> [email protected] postinstall /home/lala/projects/electron/my-app/node_modules/electron
> node install.js

(node:7836) UnhandledPromiseRejectionWarning: RequestError: connect ETIMEDOUT 13.229.188.59:443
at ClientRequest.<anonymous> (/home/lala/projects/electron/my-app/node_modules/got/source/request-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:313:26)
at ClientRequest.emit (events.js:228:7)
at ClientRequest.origin.emit (/home/lala/projects/electron/my-app/node_modules/@szmarczak/http-timer/source/index.js:37:11)
at TLSSocket.socketErrorListener (_http_client.js:406:9)
at TLSSocket.emit (events.js:223:5)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
(node:7836) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7836) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

+ [email protected]
added 85 packages from 91 contributors and audited 102 packages in 80.372s

2 packages are looking for funding
run `npm fund` for details

found 0 vulnerabilities

```
2020-02-05 09:21:18 +08:00
回复了 fenglala 创建的主题 Electron 如何正确挂代理解决执行 npm install 出现连接错误的问题?
@learnshare 谢谢提议,我试一下
1  2  3  4  5  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2739 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 14ms · UTC 12:08 · PVG 20:08 · LAX 04:08 · JFK 07:08
Developed with CodeLauncher
♥ Do have faith in what you're doing.