Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NPM behind proxy returning HTML

Tags:

node.js

npm

proxy

I'm new to NPM and I think I've managed to finally get past the corporate proxy in place using these settings:

proxy = http://MyUsername:MyPassword@MyProxy:MyPort
https-proxy = http://MyUsername:MyPassword@MyProxy:MyPort
strict-ssl = false
registry = http://registry.npmjs.org/

However, when I run an NPM command, such as npm search or npm --proxy http://username:[email protected]:80 install packagename, I get the following error, which I don't understand:

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   'search' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 warn Building the local index for the first time, please be patient
6 verbose url raw /-/all
7 verbose url resolving [ 'http://registry.npmjs.org/', './-/all' ]
8 verbose url resolved http://registry.npmjs.org/-/all
9 info trying registry request attempt 1 at 15:32:46
10 http GET http://registry.npmjs.org/-/all
11 http 407 http://registry.npmjs.org/-/all
12 verbose bad json <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
12 verbose bad json <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
12 verbose bad json <head>
12 verbose bad json
12 verbose bad json <title>Error Message</title>
12 verbose bad json <meta http-equiv="content-type" content="text/html; charset=utf-8" />
12 verbose bad json
12 verbose bad json <style>
12 verbose bad json body {
12 verbose bad json
12 verbose bad json     background:#e5eaf5 url(/Wbo-BC742A09-E6FA-4945-A21A-856A1F5CED22/bg.gif) top left repeat-x ;
12 verbose bad json     margin:0px 0px 0px 0px;
12 verbose bad json     font-family:Arial, Helvetica, sans-serif;
12 verbose bad json     min-width:1000px;
12 verbose bad json     font-size:12px;
12 verbose bad json     color:#000000;
12 verbose bad json     direction:ltr;
12 verbose bad json     }
12 verbose bad json img {border:none}
12 verbose bad json
12 verbose bad json
12 verbose bad json     .main {
12 verbose bad json         width:100%;
12 verbose bad json         background:url(/Wbo-BC742A09-E6FA-4945-A21A-856A1F5CED22/topright.gif) top right no-repeat;
12 verbose bad json         min-width:1000px;
12 verbose bad json         min-height:400px;
12 verbose bad json         margin-left:auto;
12 verbose bad json         margin-right:auto;
12 verbose bad json         text-align:left;
12 verbose bad json     }
12 verbose bad json
12 verbose bad json     .logo {float:left;  height:103px; }
12 verbose bad json     .sidetext {float:right; width:182px; height:52px; background:url(/Wbo-BC742A09-E6FA-4945-A21A-856A1F5CED22/sidetext.png) top left; border:1px solid #2a2e31; margin-right:20px; margin-top:20px; padding:4px; }
12 verbose bad json     .sidetextNone {visibility:hidden; }
12 verbose bad json
12 verbose bad json     .whiteline {float:left; clear:both; font-size:20px; margin-left:47px; margin-top:17px; color:#ffffff; white-space:nowrap; }
12 verbose bad json     .bold {font-weight:bold;}
12 verbose bad json
12 verbose bad json     .maintext {float:left; margin-top:20px; clear:both; color:#000; margin-left:47px;}
12 verbose bad json
12 verbose bad json     .color1 {color:#677183;}
12 verbose bad json
12 verbose bad json     ul {margin-top:0; padding-left:15px; padding-top:5px; padding-bottom:5px;}
12 verbose bad json
12 verbose bad json     ul li {list-style-image:url(/Wbo-BC742A09-E6FA-4945-A21A-856A1F5CED22/bullet.gif)}
12 verbose bad json     A {
12 verbose bad json     FONT-WEIGHT: bold; COLOR: #005a80;
12 verbose bad json }
12 verbose bad json A:hover {
12 verbose bad json     FONT-WEIGHT: bold;COLOR: #0d3372;
12 verbose bad json }
12 verbose bad json </style>
12 verbose bad json
12 verbose bad json </head>
12 verbose bad json <body>
12 verbose bad json     <div class="main">
12 verbose bad json         <div class="logo"><img src="/Wbo-BC742A09-E6FA-4945-A21A-856A1F5CED22/logo.png" alt="ForeFront" /></div>
12 verbose bad json         <div class="whiteline"><td id=L_default_2><span class="bold">Network Access Message:</span> The page cannot be displayed </td></div>
12 verbose bad json     <div class="maintext">
12 verbose bad json     <td id=L_default_3><span class="bold color1">Explanation:</span> There is a problem with the page you are trying to reach and it cannot be displayed. </td><br />
12 verbose bad json <br />
12 verbose bad json
12 verbose bad json <td id=L_default_5><span class="bold color1">Try the following:</span></td><br />
12 verbose bad json
12 verbose bad json <ul>
12 verbose bad json <li><td id=L_default_6><span class="bold">Refresh page:</span> Search for the page again by clicking the Refresh button. The timeout may have occurred due to Internet congestion.</td></li>
12 verbose bad json <li><td id=L_default_7><span class="bold">Check spelling:</span> Check that you typed the Web page address correctly. The address may have been mistyped.</td></li>
12 verbose bad json <li><td id=L_default_8><span class="bold">Access from a link:</span> If there is a link to the page you are looking for, try accessing the page from that link.</td></li>
12 verbose bad json </ul>
12 verbose bad json <br />
12 verbose bad json
12 verbose bad json <td id=L_default_9><span>If you are still not able to view the requested page, try contacting your administrator or Helpdesk.</span> </td><br />
12 verbose bad json
12 verbose bad json <br />
12 verbose bad json <td id=L_default_10><span class="bold color1">Technical Information (for support personnel)</span></td><br />
12 verbose bad json <ul>
12 verbose bad json <li><td id=L_default_11><span class="bold">Error Code:</span></td> 407 Proxy Authentication Required. Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. (12209).</li>
12 verbose bad json <li><td id=L_default_12><span class="bold">IP Address:</span></td> 185.31.17.162</li>
12 verbose bad json <li><td id=L_default_13><span class="bold">Date:</span></td> 2014/03/11 01:32:47 PM [GMT]</li>
12 verbose bad json <li><td id=L_default_14><span class="bold">Server:</span></td> OBTMG01.(MyCompany).local </li>
12 verbose bad json <li><td id=L_default_15><span class="bold">Source:</span></td> proxy  </li>
12 verbose bad json </ul>
12 verbose bad json     </div>
12 verbose bad json </div>
12 verbose bad json </body>
12 verbose bad json </html>
13 error registry error parsing json
14 error SyntaxError: Unexpected token
14 error <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
14 error <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
14 error <head>
14 error
14 error <title>Error Message</title>
14 error <meta http-equiv="content-type" content="text/html; charset=utf-8" />
14 error
14 error <style>
14 error body {
14 error
14 error    background:#e5eaf5 url(/Wbo-BC742A09-E6FA-4945-A21A-856A1F5CED22/bg.gif) top left repeat-x ;
14 error    margin:0px 0px 0px 0px;
14 error    font-family:Arial, Helvetica, sans-serif;
14 error    min-width:1000px;
14 error    font-size:12px;
14 error    color:#000000;
14 error    direction:ltr;
14 error    }
14 error img {border:none}
14 error
14 error
14 error    .main {
14 error        width:100%;
14 error        background:url(/Wbo-BC742A09-E6FA-4945-A21A-856A1F5CED22/topright.gif) top right no-repeat;
14 error        min-width:1000px;
14 error        min-height:400px;
14 error        margin-left:auto;
14 error        margin-right:auto;
14 error        text-align:left;
14 error    }
14 error
14 error    .logo {float:left;  height:103px; }
14 error    .sidetext {float:right; width:182px; height:52px; background:url(/Wbo-BC742A09-E6FA-4945-A21A-856A1F5CED22/sidetext.png) top left; border:1px solid #2a2e31; margin-right:20px; margin-top:20px; padding:4px; }
14 error    .sidetextNone {visibility:hidden; }
14 error
14 error    .whiteline {float:left; clear:both; font-size:20px; margin-left:47px; margin-top:17px; color:#ffffff; white-space:nowrap; }
14 error    .bold {font-weight:bold;}
14 error
14 error    .maintext {float:left; margin-top:20px; clear:both; color:#000; margin-left:47px;}
14 error
14 error    .color1 {color:#677183;}
14 error
14 error    ul {margin-top:0; padding-left:15px; padding-top:5px; padding-bottom:5px;}
14 error
14 error    ul li {list-style-image:url(/Wbo-BC742A09-E6FA-4945-A21A-856A1F5CED22/bullet.gif)}
14 error    A {
14 error     FONT-WEIGHT: bold; COLOR: #005a80;
14 error }
14 error A:hover {
14 error     FONT-WEIGHT: bold;COLOR: #0d3372;
14 error }
14 error </style>
14 error
14 error </head>
14 error <body>
14 error    <div class="main">
14 error         <div class="logo"><img src="/Wbo-BC742A09-E6FA-4945-A21A-856A1F5CED22/logo.png" alt="ForeFront" /></div>
14 error         <div class="whiteline"><td id=L_default_2><span class="bold">Network Access Message:</span> The page cannot be displayed </td></div>
14 error     <div class="maintext">
14 error     <td id=L_default_3><span class="bold color1">Explanation:</span> There is a problem with the page you are trying to reach and it cannot be displayed. </td><br />
14 error <br />
14 error
14 error <td id=L_default_5><span class="bold color1">Try the following:</span></td><br />
14 error
14 error <ul>
14 error <li><td id=L_default_6><span class="bold">Refresh page:</span> Search for the page again by clicking the Refresh button. The timeout may have occurred due to Internet congestion.</td></li>
14 error <li><td id=L_default_7><span class="bold">Check spelling:</span> Check that you typed the Web page address correctly. The address may have been mistyped.</td></li>
14 error <li><td id=L_default_8><span class="bold">Access from a link:</span> If there is a link to the page you are looking for, try accessing the page from that link.</td></li>
14 error </ul>
14 error <br />
14 error
14 error <td id=L_default_9><span>If you are still not able to view the requested page, try contacting your administrator or Helpdesk.</span> </td><br />
14 error
14 error <br />
14 error <td id=L_default_10><span class="bold color1">Technical Information (for support personnel)</span></td><br />
14 error <ul>
14 error <li><td id=L_default_11><span class="bold">Error Code:</span></td> 407 Proxy Authentication Required. Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. (12209).</li>
14 error <li><td id=L_default_12><span class="bold">IP Address:</span></td> 185.31.17.162</li>
14 error <li><td id=L_default_13><span class="bold">Date:</span></td> 2014/03/11 01:32:47 PM [GMT]</li>
14 error <li><td id=L_default_14><span class="bold">Server:</span></td> OBTMG01.(MyCompany).local </li>
14 error <li><td id=L_default_15><span class="bold">Source:</span></td> proxy  </li>
14 error </ul>
14 error     </div>
14 error </div>
14 error </body>
14 error </html>
14 error
14 error     at Object.parse (native)
14 error     at RegClient.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:203:23)
14 error     at Request.self.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:123:22)
14 error     at Request.EventEmitter.emit (events.js:98:17)
14 error     at Request.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:893:14)
14 error     at Request.EventEmitter.emit (events.js:117:20)
14 error     at IncomingMessage.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:844:12)
14 error     at IncomingMessage.EventEmitter.emit (events.js:117:20)
14 error     at _stream_readable.js:920:16
14 error     at process._tickCallback (node.js:415:13)
15 error If you need help, you may report this *entire* log,
15 error including the npm and node versions, at:
15 error     <http://github.com/npm/npm/issues>
16 error System Windows_NT 6.1.7601
17 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "search"
18 error cwd C:\Users\(MyUsername)
19 error node -v v0.10.26
20 error npm -v 1.4.3
21 error type unexpected_token
22 verbose exit [ 1, true ]
like image 394
Andre Ogle Avatar asked Mar 11 '14 13:03

Andre Ogle


People also ask

How to reset npm proxy?

By running npm config rm proxy you remove proxy from user configuration. This can be easily verified by running: npm config list. If there is proxy or https-proxy setting set in global config you have to use --global in the command to remove it.

What is npm http proxy?

node-http-proxy. node-http-proxy is an HTTP programmable proxying library that supports websockets. It is suitable for implementing components such as reverse proxies and load balancers.

Why npm install is not working?

The Npm command not found error can appear when you install or upgrade npm. On Windows, the cause of this error could be that a PATH or system variable is not correctly set. The error can also occur if you do not have npm or Node. js installed, have an outdated version, or have permission issues.


1 Answers

It looks like you're still not getting through the proxy.

407 Proxy Authentication Required. Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. (12209)

You may need to set up something like cntlm if your proxy authentication uses the digest method.

like image 185
Sam Mikes Avatar answered Oct 05 '22 13:10

Sam Mikes