网络连接ETIMEDOUT,用于在VM中安装Protractor

时间:2014-12-02 13:01:00

标签: node.js npm protractor

Background_Note: 我已在所有全局/主机中成功安装了量角器。但同样在VM中也不起作用。

也就是说,此问题仅出现在Windows 7虚拟机中,而不是其他情况。 所有这些机器(VM,主机和个人机器)都具有相同的代理设置,我在npm配置中设置相同的设置。

npm config set proxy http://proxy_server:8080
npm config set https-proxy http://proxy_server:8080


现在我尝试了这个程序:

  1. 我在以非管理员用户身份登录的Windows 7远程桌面(VM)中
  2. 我以管理员身份打开了cmd窗口。
  3. 尝试安装量角器
  4. npm install -g protractor

    1. 此安装失败,下面附有日志和配置列表。
    2. 尝试了Bower error tunneling socket could not be established, cause=Parse Error的所有可能答案 ==>他们不适合我。
    3. C:\Windows\system32>npm config list
      ; cli configs
      registry = "http://registry.npmjs.org/"
      user-agent = "npm/1.4.28 node/v0.10.33 win32 x64"
      
      ; userconfig C:\Users\test\.npmrc
      registry = "http://registry.npmjs.org/"
      
      ; builtin config undefined
      prefix = "C:\\Users\\test\\AppData\\Roaming\\npm"
      
      ; node bin location = C:\Program Files\nodejs\\node.exe
      ; cwd = C:\Windows\system32
      ; HOME = C:\Users\test
      ; 'npm config ls -l' to show all defaults.

      C:\ Windows \ System32下>

      日志写在npm-debug.log:

      0 info it worked if it ends with ok
      1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
      1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
      1 verbose cli   'install',
      1 verbose cli   '-g',
      1 verbose cli   'protractor',
      1 verbose cli   '--registry',
      1 verbose cli   'http://registry.npmjs.org/' ]
      2 info using npm@1.4.28
      3 info using node@v0.10.33
      4 verbose node symlink C:\Program Files\nodejs\\node.exe
      5 verbose cache add [ 'protractor', null ]
      6 verbose cache add name=undefined spec="protractor" args=["protractor",null]
      7 verbose parsed url { protocol: null,
      7 verbose parsed url   slashes: null,
      7 verbose parsed url   auth: null,
      7 verbose parsed url   host: null,
      7 verbose parsed url   port: null,
      7 verbose parsed url   hostname: null,
      7 verbose parsed url   hash: null,
      7 verbose parsed url   search: null,
      7 verbose parsed url   query: null,
      7 verbose parsed url   pathname: 'protractor',
      7 verbose parsed url   path: 'protractor',
      7 verbose parsed url   href: 'protractor' }
      8 silly lockFile 4f4f4858-protractor protractor
      9 verbose lock protractor C:\Users\test\AppData\Roaming\npm-cache\4f4f4858-protractor.lock
      10 silly lockFile 4f4f4858-protractor protractor
      11 silly lockFile 4f4f4858-protractor protractor
      12 verbose addNamed [ 'protractor', '' ]
      13 verbose addNamed [ null, '*' ]
      14 silly lockFile 80d5ca5a-protractor protractor@
      15 verbose lock protractor@ C:\Users\test\AppData\Roaming\npm-cache\80d5ca5a-protractor.lock
      16 silly addNameRange { name: 'protractor', range: '*', hasData: false }
      17 verbose request where is /protractor
      18 verbose request registry http://registry.npmjs.org/
      19 verbose request id b468ffda57abdf0d
      20 verbose url raw /protractor
      21 verbose url resolving [ 'http://registry.npmjs.org/', './protractor' ]
      22 verbose url resolved http://registry.npmjs.org/protractor
      23 verbose request where is http://registry.npmjs.org/protractor
      24 info trying registry request attempt 1 at 18:20:15
      25 http GET http://registry.npmjs.org/protractor
      26 info retry will retry, error on last attempt: Error: connect ETIMEDOUT
      27 info trying registry request attempt 2 at 18:20:47
      28 http GET http://registry.npmjs.org/protractor
      29 info retry will retry, error on last attempt: Error: connect ETIMEDOUT
      30 info trying registry request attempt 3 at 18:22:08
      31 http GET http://registry.npmjs.org/protractor
      32 silly lockFile 80d5ca5a-protractor protractor@
      33 silly lockFile 80d5ca5a-protractor protractor@
      34 error network connect ETIMEDOUT
      34 error network This is most likely not a problem with npm itself
      34 error network and is related to network connectivity.
      34 error network In most cases you are behind a proxy or have bad network settings.
      34 error network
      34 error network If you are behind a proxy, please make sure that the
      34 error network 'proxy' config is set properly.  See: 'npm help config'
      35 error System Windows_NT 6.1.7600
      36 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "protractor" "--registry" "http://registry.npmjs.org/"
      37 error cwd C:\Windows\system32
      38 error node -v v0.10.33
      39 error npm -v 1.4.28
      40 error syscall connect
      41 error code ETIMEDOUT
      42 error errno ETIMEDOUT
      43 verbose exit [ 1, true ]

1 个答案:

答案 0 :(得分:1)

解决。 使用VM并且它具有某些代理集时,请使用全局代理(所有其他代理的根)。 因此,在安装量角器之前运行这两个命令:

C:\Windows\system32>npm config set registry "http://registry.npmjs.org/"
C:\Windows\system32>npm config set proxy http://global.proxy.alcatel-lucent.com:8000

解决问题