如何在NTLM的代理的后面,使用npm安装node.js的扩展

今天有些时间学习新知识了。

另一个项目,实现了第一阶段的联调的通过。静下心来几天,庆祝一下这个节点。

顺便学习node.js

一个重要的要解决的问题,就是如何在NTLM后面,使用npm。

事实上,这是一个古老的,linux体系的一个大bug: 设置代理时,不能使用域,只能使用有主机名的(好象iMac解决了)。

今天找了一上午,终于找到一个可能的办法:

http://stackoverflow.com/questions/18569054/npm-behind-ntlm-proxy

原理就是,先在本地搭一下代理,这样一来,代理字串就变面这样了:

http://localhost:53128

而不是http://myadname\\proxyhostname:port的样子了。

*******************************************

虽然说,网上有许多文章,说可以用这样的方式

proxy = http://domain\\username:[email protected]:port

但事实证明,不论是如何设置,都是不成的。

如下的都不成:

npm config set proxy http://bj\\haoyujie:[email protected]:8080

npm config set https-proxy http://bj\\haoyujie:[email protected]:8080

npm --proxy=http://bj/haoyujie:[email protected]:8080 --proxy-https=http://bj/haoyujie:[email protected]:8080 --registry=http://registry.npmjs.org/ install mime

**********************************************

问:

Is it possible to run npm install behind an HTTP proxy, which uses NTLM authentication? If yes, how can I set the server‘s address and port, the username, and the password?

---------------

ANS:

I solved it this way (OS: Windows XP SP3):

1. Download CNTLM installer and run it.

2. Find and fill in these fields in cntlm.ini. Do not fill in thePassword field, it‘s never a good idea to store unencrypted passwords in text files.

Username    YOUR_USERNAME
Domain      YOUR_DOMAIN
Proxy       YOUR_PROXY_IP:PORT
Listen      53128

3. Open console, and type these commands to generate password hashes.

> cd c:\the_install_directory_of_cntlm
> cntlm -H
Password: ...type proxy password here...
PassLM          D6888AC8AE0EEE294D954420463215AE
PassNT          0E1FAED265D32EBBFB15F410D27994B2
PassNTLMv2      91E810C86B3FD1BD14342F945ED42CD6

4. Copy the above three lines into cntlm.ini, under the
Domain
field‘s line. Once more, do not fill in the Password field. Save cntlm.ini.

5. Open the Service Manager (from command line: services.msc), and start the service called "CNTLM Authentication Proxy".

6. In the console, type these lines:

> npm config set proxy http://localhost:53128
> npm config set https-proxy https://localhost:53128
> npm config set registry "http://registry.npmjs.org/"

7. Now npm view, npm install etc. should work. Example:

> npm view qunit
...nice answer, no errors :)

********************************

Ooo Yeath .

反正我的是可以用了。

感谢

http://stackoverflow.com/questions/18569054/npm-behind-ntlm-proxy

*********************************

才看到,原来这哥们使用的是我的最爱:winxp sp3

早知道我也用XP啊。一会装个XP在vmWare上。

我是在window 7 x64上试成功的。

**************************************

另外,不要尝试改:

c:\users\youname\.npmrc

没用。

*******************************

如何在NTLM的代理的后面,使用npm安装node.js的扩展

时间: 2024-12-09 17:40:49

如何在NTLM的代理的后面,使用npm安装node.js的扩展的相关文章

[译]How to Install Node.js on Ubuntu 14.04 如何在ubuntu14.04上安装node.js

**原文链接为** [http://www.hostingadvice.com/how-to/install-nodejs-ubuntu-14-04/](http://www.hostingadvice.com/how-to/install-nodejs-ubuntu-14-04/) **由作者Jacob Nicholson 发表于October 27, 2015** **在此对作者表示感谢** Node.js作为一个基于JavaScript的开发平台,正变得越来越流行.许多开发人员都想构建通过

如何在CentOS 7安装Node.js

最近,我一直对学习Node.js比较感兴趣.这是一个Java平台的服务器端编程 ,它允许开发人员在服务器编写Java代码,并且有许多CentOS的用户正努力学习这个语言的开发环境.这正是我想做这个教程的目的. 首先请确保你拥有CentOS 7.因为它是我唯一在使用的版本,当然没有绝对的保证,本指南也可在其他版本可以使用. 从源码安装Node.js 首先我们要从源码安装Node.js.我真的很喜欢从源码安装软件.在你的CentOS 7机器上打开一个新的终端标签并运行以下命令 用来下载需要使用的安装

如何在Ubuntu上安装最新版本的Node.js

如何在Ubuntu上安装最新版本的Node.js 作者:chszs,转载需注明.博客主页:http://blog.csdn.net/chszs Node.js是一个软件平台,通常用于构建大规模的服务器端应用.Node.js使用JavaScript作为其脚本语言,由于其非阻塞I/O设计以及单线程事件循环机制,使得它可以交付超高的性能. Node.js包含了Google V8 JavaScript引擎,libuv库和核心库几乎都是使用JavaScript编写的.libuv库提供了异步事件I/O的抽象

编程学习之如何在Node.js中优化服务器端渲染?[图]

编程学习之如何在Node.js中优化服务器端渲染?[图]在 Airbnb,我们花了数年时间将所有前端代码迁移到 React 架构,Ruby on Rails 在 Web 应用中所占的比例每天都在减少.实际上,我们很快会转向另一个新的服务,即通过 Node.js 提供完整的服务器端渲染页面.这个服务将为 Airbnb 的所有产品渲染大部分 HTML.这个渲染引擎不同于其他后端服务,因为它不是用 Ruby 或 Java 开发的,但它也不同于常见的 I/O 密集型 Node.js 服务.一说起 Nod

如何在CentOS 7 / Fedora 31/30/29上安装ELK Stack

原文地址:https://computingforgeeks.com/how-to-install-elk-stack-on-centos-fedora/ 原作者: Josphat Mutai 译者:高行行 如何在 CentOS 7 / Fedora 31/30/29 上安装 ELK Stack?" ELK "是 Elasticsearch, Logstash, and Kibana 的缩写. Elasticsearch:这是一个开源的.基于 REST 和 JSON 的搜索引擎.它具有

node.js 抓取代理ip

node.js实现抓取代理ip 主要文件:index.js /* * 支持:node.js v7.9.0 */ const cheerio=require('cheerio'); const fetch =require('node-fetch'); const Promise=require('bluebird'); let mongoose=require('mongoose'); Promise.promisifyAll(mongoose); let Schema=mongoose.Sch

安装Nginx并为node.js设置反向代理

最近看了反向代理和正向代理的东西,想到自己的node.js服务器是运行在3333端口的,也没有为他设置反向代理,node.js项目的一些静态文件是完全可以部署在Nginx上,以减少对node.js的请求. 着手开始做: 1.Nginx依赖gcc,pcre,zlib,openssl之类的库,通过rpm -qa | grep gcc查询,没有的话都安装上. 2.Nginx安装 准备工作 a) 创建用户nginx使用的www用户.    # groupadd  www  #添加www组       

nginx反向代理node.js获取客户端IP

使用Nginx做node.js程序的反向代理,会有这么一个问题:在程序中获取的客户端IP永远是127.0.0.1 如果想要拿到真实的客户端IP改怎么办呢? 一.首先配置Nginx的反向代理 proxy_set_header server { listen 80; server_name chat.luckybing.top; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; pro

nginx使用反向代理支持node.js服务

前言 Node.js自身能作为web服务器用,但是如果要在一台机器上开启多个Node.js应用该如何做呢?有一种答案就是使用nginx做反向代理.反向代理在这里的作用就是,当代理服务器接收到请求,将请求转发到目的服务器,然后获取数据后返回. 步骤 一.正常使用node.js开启web服务 var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {'Co