npm安装gifsicle背后的企业代理失败或卡在Windows系统

时间:2018-01-17 09:39:22

标签: node.js npm gifsicle

windows 7, npm@3.10.3, node@v6.7.0

npm和git设置为使用公司代理。 我花了一段时间才弄清楚git和npm如何使用公司代理,幸运的是它成功完成了。 npm配置文件(.npmrc)看起来像:

strict-ssl=false
proxy=http://domain%5Cmyname:mypassword@corporateproxy:8088/
http-proxy=http://domain%5Cmyname:mypassword@corporateproxy:8088/
https-proxy=http://domain%5Cmyname:mypassword@corporateproxy:8088/
cache-lock-wait=30000
cache-lock-retries=10
cache-lock-stale=300000

开始安装

npm install gifsicle --verbose

以下是日志记录:

C:\temp\2018_0110\estatico>npm install gifsicle --verbose
npm info it worked if it ends with ok
npm verb cli [ 'C:\\temp\\TOOLS\\PortableNode\\node.exe',
npm verb cli   'C:\\temp\\TOOLS\\PortableNode\\node_modules\\npm\\bin\\npm-cli.j
s',
npm verb cli   'install',
npm verb cli   'gifsicle',
npm verb cli   '--verbose' ]
npm info using npm@3.10.3
npm info using node@v6.7.0
npm verb request uri https://registry.npmjs.org/gifsicle
npm verb request no auth needed
npm info attempt registry request try #1 at 09:00:29
npm verb request id 7014dcca318052d1
npm verb etag "5a108ad8-73b8"
npm verb lastModified Sat, 18 Nov 2017 19:32:40 GMT
npm http request GET https://registry.npmjs.org/gifsicle
npm http 304 https://registry.npmjs.org/gifsicle
npm verb headers { date: 'Wed, 17 Jan 2018 08:00:14 GMT',
npm verb headers   via: '1.1 varnish',
npm verb headers   'cache-control': 'max-age=300',
npm verb headers   etag: '"5a108ad8-73b8"',
npm verb headers   age: '13585',
npm verb headers   connection: 'close',
npm verb headers   'x-served-by': 'cache-hhn1546-HHN',
npm verb headers   'x-cache': 'HIT',
npm verb headers   'x-cache-hits': '10',
npm verb headers   'x-timer': 'S1516176014.461012,VS0,VE0',
npm verb headers   vary: 'Accept-Encoding, Accept' }
npm verb etag https://registry.npmjs.org/gifsicle from cache
npm verb get saving gifsicle to C:\Users\MYUSERHOME\AppData\Roaming\npm-cach
e\registry.npmjs.org\gifsicle\.cache.json
npm verb correctMkdir C:\Users\MYUSERHOME\AppData\Roaming\npm-cache correctM
kdir not in flight; initializing
npm verb cache add spec gifsicle
npm verb addNamed "latest" is being treated as a dist-tag for gifsicle
npm info addNameTag [ 'gifsicle', 'latest' ]
npm verb addNameTag registry:https://registry.npmjs.org/gifsicle not in flight;
fetching
npm verb get https://registry.npmjs.org/gifsicle not expired, no request
npm verb addNamed "3.0.4" is a plain semver version for gifsicle
npm verb afterAdd C:\Users\MYUSERHOME\AppData\Roaming\npm-cache\gifsicle\3.0
.4\package\package.json not in flight; writing
npm verb correctMkdir C:\Users\MYUSERHOME\AppData\Roaming\npm-cache correctM
kdir not in flight; initializing
npm verb afterAdd C:\Users\MYUSERHOME\AppData\Roaming\npm-cache\gifsicle\3.0
.4\package\package.json written
npm verb correctMkdir C:\Users\MYUSERHOME\AppData\Roaming\npm-cache\_locks c
orrectMkdir not in flight; initializing
npm verb lock using C:\Users\MYUSERHOME\AppData\Roaming\npm-cache\_locks\sta
ging-fdad36d07e8f1a67.lock for C:\temp\2018_0110\estatico\node_modules\.staging
npm verb unbuild node_modules\.staging\gifsicle-c326b995
npm verb gentlyRm don't care about contents; nuking C:\temp\2018_0110\estatico\n
ode_modules\.staging\gifsicle-c326b995
npm verb tar unpack C:\Users\MYUSERHOME\AppData\Roaming\npm-cache\gifsicle\3
.0.4\package.tgz
npm verb tar unpacking to C:\temp\2018_0110\estatico\node_modules\.staging\gifsi
cle-c326b995
npm verb gentlyRm don't care about contents; nuking C:\temp\2018_0110\estatico\n
ode_modules\.staging\gifsicle-c326b995
npm verb gentlyRm don't care about contents; nuking C:\temp\2018_0110\estatico\n
ode_modules\.staging\gifsicle-c326b995\node_modules
npm info lifecycle gifsicle@3.0.4~preinstall: gifsicle@3.0.4
npm info linkStuff gifsicle@3.0.4
npm verb linkBins gifsicle@3.0.4
npm verb link bins [ { gifsicle: 'cli.js' },
npm verb link bins   'C:\\temp\\2018_0110\\estatico\\node_modules\\.bin',
npm verb link bins   false ]
npm verb linkMans gifsicle@3.0.4
npm info lifecycle gifsicle@3.0.4~install: gifsicle@3.0.4
npm info lifecycle gifsicle@3.0.4~postinstall: gifsicle@3.0.4

> gifsicle@3.0.4 postinstall C:\temp\2018_0110\estatico\node_modules\gifsicle
> node lib/install.js

1。)安装在gifsicle@3.0.4 postinstall脚本'节点lib / install.js'中长时间停留。

2.)15分钟或更长时间的下一条消息

  ‼ tunneling socket could not be established, cause=read ECONNRESET
  ‼ gifsicle pre-build test failed
  i compiling from source

3.)最后一条消息

× RequestError: tunneling socket could not be established, cause=socket hang u
p
    at ClientRequest.<anonymous> (C:\temp\2018_0110\estatico\node_modules\got\in
dex.js:74:21)
    at ClientRequest.g (events.js:291:16)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at ClientRequest.onError (C:\temp\2018_0110\estatico\node_modules\caw\node_m
odules\tunnel-agent\index.js:178:21)
    at ClientRequest.g (events.js:291:16)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at TLSSocket.socketErrorListener (_http_client.js:308:9)
    at emitOne (events.js:96:13)
npm verb lifecycle gifsicle@3.0.4~postinstall: unsafe-perm in lifecycle true
npm verb lifecycle gifsicle@3.0.4~postinstall: PATH: C:\temp\TOOLS\PortableNode\
node_modules\npm\bin\node-gyp-bin;C:\temp\2018_0110\estatico\node_modules\gifsic
le\node_modules\.bin;C:\temp\2018_0110\estatico\node_modules\.bin;C:\temp\TOOLS\
PortableNode;C:\temp\TOOLS\PortableNode;C:\temp\TOOLS\PortableGit\cmd;C:\Program
 Files (x86)\MQSeries Client\Java\lib;C:\ProgramData\Oracle\Java\javapath;C:\Win
dows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPow
erShell\v1.0\;C:\Program Files (x86)\CTV_V7_E-I\isiscomm\w3\lib;C:\Program Files
 (x86)\MQSeries Client\bin64;C:\Program Files (x86)\MQSeries Client\bin;C:\Progr
am Files (x86)\MQSeries Client\tools\c\samples\bin;C:\Program Files\Citrix\Syste
m32\;C:\Program Files\Citrix\ICAService\;C:\Program Files (x86)\UltraEdit\;C:\Pr
ogram files\IBM\sqllib\bin;C:\Program files\IBM\sqllib\funtion;C:\Program Files
(x86)\Subversion;C:\Program Files\TortoiseSVN\bin;C:\Users\MYUSERHOME\.dnx\b
in;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\8.1\
Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\120\Tools\Bin
n\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\
McAfee\MOVE AV Client\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Fi
les (x86)\TAA\taaseu;C:\Program Files (x86)\UltraEdit
npm verb lifecycle gifsicle@3.0.4~postinstall: CWD: C:\temp\2018_0110\estatico\n
ode_modules\gifsicle
npm verb unlock done using C:\Users\MYUSERHOME\AppData\Roaming\npm-cache\_lo
cks\staging-fdad36d07e8f1a67.lock for C:\temp\2018_0110\estatico\node_modules\.s
taging
estatico@5.0.0 C:\temp\2018_0110\estatico
`-- gulp-imagemin@3.0.3
  `-- imagemin-gifsicle@5.2.0
    `-- gifsicle@3.0.4

npm verb exit [ 0, true ]
npm info ok

虽然将触发安装node-gyp,但似乎没有使用npm的代理设置。

我可以成功地在另一台计算机和direkt internetconnection中安装gifsicle而没有任何问题。

问:有没有人成功安装gifsicle公司代理,然后请告诉我它是如何完成的?

修改 这是它至少陷入困境的部分。 C:\ temp \ estatico \ node_modules \ gifsicle \ lib&gt; node install.js --verbose

'use strict';
var BinBuild = require('bin-build');
var log = require('logalot');
var bin = require('./');

bin.run(['--version'], function (err) {
    if (err) {
        log.warn(err.message);
        log.warn('gifsicle pre-build test failed');
        log.info('compiling from source');

        var cfg = [
            './configure --disable-gifview --disable-gifdiff',
            '--prefix="' + bin.dest() + '" --bindir="' + bin.dest() + '"'
        ].join(' ');

        var builder = new BinBuild()
            .src('https://github.com/kohler/gifsicle/archive/v1.88.tar.gz')
            .cmd('autoreconf -ivf')
            .cmd(cfg)
            .cmd('make install');

        return builder.run(function (err) {
            if (err) {
                log.error(err.stack);
                return;
            }

            log.success('gifsicle built successfully');
        });
    }

    log.success('gifsicle pre-build test passed successfully');
});

2 个答案:

答案 0 :(得分:0)

要通过防火墙安装npm软件包我发现我需要设置代理环境变量而不是使用npm config。对于不同版本的npm,这似乎有所改变。我目前设置了#http_proxy&#39;和&#39; https_proxy&#39;这似乎涵盖了我使用的所有npm版本。

我没有使用过gifsicle

答案 1 :(得分:0)

我已经遇到了类似的问题,其中大多数软件包的安装命令并不完全相同。我落后于公司代理。 为此,我尝试了许多没有用的解决方案。 终于我做到了,

尝试在cmd中运行以下命令, npm config set https-proxy“ http://your_companyproxy_here:8080

然后它将正常工作。