首页 文章

在SOCKS代理后面运行Node.js和Meteor

提问于
浏览
0

我在许多网站被阻止的国家/地区连接到互联网 . 所以连接方法是:

ssh -D 3030 root@46.101.111.333

然后我在网络偏好设置中配置

enter image description here

这样我就可以使用我的浏览器连接到任何地方 . 没问题 . 但是当我想在终端上安装NPM模块或Meteor.js插件时出现错误 .

在NPM中:

错误:'ECONNREFUSED'如果您在代理服务器后面,请确保正确设置'proxy'配置 . 请参阅:'npm help config'

在METEOR:

无法更新软件包目录(您是否脱机?)如果您在代理后面使用Meteor,请设置HTTP_PROXY和HTTPS_PROXY环境变量,或者查看此页面以获取更多详细信息:https://github.com/meteor/meteor/wiki/Using -Meteor-背后一个代理


我遵循了Meteor和NPM文件 .

流星

export HTTP_PROXY=http://root:password@46.101.111.333:3030
export HTTPS_PROXY=http://root:password@46.101.111.333:3030
meteor update

NPM

npm config set proxy http://root:password@46.101.111.333:3030
npm config set https-proxy http://root:password@46.101.111.333:3030

还有一些......

请帮忙,我还需要做什么..是ssh还是代理特定的问题 . 我的设置是否正确?

1 回答

  • 2

    假设您的SOCKS5代理是: 127.0.0.1:3030 ...

    • 由homebrew安装 proxychains-ng

    • 创建 ~/.proxychains/proxychains.conf

    例如,您可能需要添加一行:

    socks5 127.0.0.1 3030

    以下 [ProxyList]

    # proxychains.conf  VER 4
    #
    #        HTTP, SOCKS4, SOCKS5 tunneling proxifier with DNS.
    #   
    
    # The option below identifies how the ProxyList is treated.
    # only one option should be uncommented at time,
    # otherwise the last appearing option will be accepted
    #
    #dynamic_chain
    #
    # Dynamic - Each connection will be done via chained proxies
    # all proxies chained in the order as they appear in the list
    # at least one proxy must be online to play in chain
    # (dead proxies are skipped)
    # otherwise EINTR is returned to the app
    #
    strict_chain
    #
    # Strict - Each connection will be done via chained proxies
    # all proxies chained in the order as they appear in the list
    # all proxies must be online to play in chain
    # otherwise EINTR is returned to the app
    #
    #random_chain
    #
    # Random - Each connection will be done via random proxy
    # (or proxy chain, see  chain_len) from the list.
    # this option is good to test your IDS :)
    
    # Make sense only if random_chain
    #chain_len = 2
    
    # Quiet mode (no output from library)
    #quiet_mode
    
    # Proxy DNS requests - no leak for DNS data
    proxy_dns 
    
    # set the class A subnet number to usefor use of the internal remote DNS mapping
    # we use the reserved 224.x.x.x range by default,
    # if the proxified app does a DNS request, we will return an IP from that range.
    # on further accesses to this ip we will send the saved DNS name to the proxy.
    # in case some control-freak app checks the returned ip, and denies to 
    # connect, you can use another subnet, e.g. 10.x.x.x or 127.x.x.x.
    # of course you should make sure that the proxified app does not need
    # *real* access to this subnet. 
    # i.e. dont use the same subnet then in the localnet section
    #remote_dns_subnet 127 
    #remote_dns_subnet 10
    remote_dns_subnet 224
    
    # Some timeouts in milliseconds
    tcp_read_time_out 15000
    tcp_connect_time_out 8000
    
    # By default enable localnet for loopback address ranges
    # RFC5735 Loopback address range
    localnet 127.0.0.0/255.0.0.0
    # RFC1918 Private Address Ranges
    # localnet 10.0.0.0/255.0.0.0
    # localnet 172.16.0.0/255.240.0.0
    # localnet 192.168.0.0/255.255.0.0
    
    
    # Example for localnet exclusion
    ## Exclude connections to 192.168.1.0/24 with port 80
    # localnet 192.168.1.0:80/255.255.255.0
    
    ## Exclude connections to 192.168.100.0/24
    # localnet 192.168.100.0/255.255.255.0
    
    ## Exclude connections to ANYwhere with port 80
    # localnet 0.0.0.0:80/0.0.0.0
    
    # ProxyList format
    #       type  host  port [user pass]
    #       (values separated by 'tab' or 'blank')
    #
    #
    #        Examples:
    #
    #               socks5  192.168.67.78   1080    lamer   secret
    #       http    192.168.89.3    8080    justu   hidden
    #       socks4  192.168.1.49    1080
    #           http    192.168.39.93   8080    
    #       
    #
    #       proxy types: http, socks4, socks5
    #        ( auth types supported: "basic"-http  "user/pass"-socks )
    #
    [ProxyList]
    # add proxy here ...
    # meanwile
    # defaults set to "tor"
    socks5  127.0.0.1 3030
    

    然后通过在前面添加 proxychains4 来运行 meteor ,例如:

    proxychains4 meteor add angularui:angular-ui-router
    

相关问题