问题描述
是否可以在使用 npm install
href="http://en.wikipedia.org/wiki/NTLM">NTLM 身份验证?如果可以,如何设置服务器的地址和端口、用户名和密码?
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?
推荐答案
我是这样解决的(操作系统:Windows XP SP3):
I solved it this way (OS: Windows XP SP3):
1. 下载 CNTLM 安装程序并运行它.
1. Download CNTLM installer and run it.
2. 在 cntlm.ini 中查找并填写这些字段.不要填写密码
字段,将未加密的密码存储在文本文件中绝不是一个好主意.
2. Find and fill in these fields in cntlm.ini. Do not fill in the Password
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. 打开控制台,然后键入这些命令以生成密码哈希.
3. Open console, and type these commands to generate password hashes.
> cd c: he_install_directory_of_cntlm
> cntlm -H
Password: ...type proxy password here...
PassLM D6888AC8AE0EEE294D954420463215AE
PassNT 0E1FAED265D32EBBFB15F410D27994B2
PassNTLMv2 91E810C86B3FD1BD14342F945ED42CD6
4. 将以上三行复制到cntlm.ini 中,在Domain
字段的行下.再次,不要填写Password
字段.保存cntlm.ini.
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. 打开服务管理器(从命令行:services.msc),并启动名为CNTLM Authentication Proxy"的服务.
5. Open the Service Manager (from command line: services.msc), and start the service called "CNTLM Authentication Proxy".
6. 在控制台中,输入以下几行:
6. In the console, type these lines:
> npm config set proxy http://localhost:53128
> npm config set https-proxy http://localhost:53128
> npm config set registry https://registry.npmjs.org
7. 现在 npm view
、npm install
等应该可以工作了.示例:
7. Now npm view
, npm install
etc. should work. Example:
> npm view qunit
...nice answer, no errors :)
这篇关于NTLM 代理背后的 NPM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!