我正在使用yeoman构建我的角度应用程序。
我已按如下方式设置代理和注册表:
npm config set proxy http://proxy.tcs.com:8080
npm config set https-proxy http://proxy.tcs.com:8080
npm config set registry http://registry.npmjs.org/
即使在安装
之后设置了上述代理npm install grunt-ngmin,
我收到以下错误,
npm WARN package.json teamshareangular@0.0.0 No README.md file found!
npm http GET http://registry.npmjs.org/grunt-ngmin
npm http 407 http://registry.npmjs.org/grunt-ngmin
npm ERR! registry error parsing json
npm ERR! SyntaxError: Unexpected token <
npm ERR! <HEAD><TITLE>Proxy Authorization Required</TITLE></HEAD>
npm ERR! <BODY BGCOLOR="white" FGCOLOR="black"><H1>Proxy Authorization Required</H1><HR>
npm ERR! <FONT FACE="Helvetica,Arial"><B>
npm ERR! Description: Authorization is required for access to this proxy</B></FONT>
npm ERR! <HR>
npm ERR! <!-- default "Proxy Authorization Required" response (407) -->
npm ERR! </BODY>
npm ERR!
npm ERR! at Object.parse (native)
npm ERR! at RegClient.<anonymous> (C:\Users\Documents\tools\nodejs\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:235:23)
npm ERR! at Request.self.callback (C:\Users\Documents\tools\nodejs\nodejs\node_modules\npm\node_modules\request\main.js:120:22)
npm ERR! at Request.EventEmitter.emit (events.js:98:17)
npm ERR! at Request.<anonymous> (C:\Users\Documents\tools\nodejs\nodejs\node_modules\npm\node_modules\request\main.js:648:16)
npm ERR! at Request.EventEmitter.emit (events.js:117:20)
npm ERR! at IncomingMessage.<anonymous> (C:\Users\Documents\tools\nodejs\nodejs\node_modules\npm\node_modules\request\main.js:610:14)
npm ERR! at IncomingMessage.EventEmitter.emit (events.js:117:20)
npm ERR! at _stream_readable.js:910:16
npm ERR! at process._tickCallback (node.js:415:13)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Users\\\Documents\\tools\\nodejs\\nodejs\\\\node.exe" "C:\\Users\\\Documents\\tools\\nodejs\\nodejs\\node_modules\\npm\\bin\\npm-cli.j
"grunt-ngmin"
npm ERR! cwd C:\nodejs\Teamshare\Teamshareangular
npm ERR! node -v v0.10.7
npm ERR! npm -v 1.2.14
npm ERR! type unexpected_token
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\nodejs\Teamshare\Teamshareangular\npm-debug.log
npm ERR! not ok code 0
该怎么做?
我应该在npm中进行一些其他设置吗?
请建议。
答案 0 :(得分:8)
您的代理需要身份验证。如果您的控件中有代理,则创建一个用户并使用folowing命令配置npm以使用您的凭证。 (注意用户&在主机名之前传递)
$ npm config set proxy http://login:pass@host:port
$ npm config set https-proxy http://login:pass@host:port
答案 1 :(得分:1)