我是npm和node的新手。目前我正在尝试使用npm install
来获取我的项目的依赖项,这需要调用我公司的本地npm注册表来链接项目。在安装过程中,我收到此错误:
npm verb stack TypeError: The header content contains invalid characters
npm verb stack at ClientRequest.OutgoingMessage.setHeader (_http_outgoing.js:348:11)
npm verb stack at new ClientRequest (_http_client.js:85:14)
npm verb stack at Object.exports.request (http.js:31:10)
npm verb stack at Object.exports.request (https.js:199:15)
npm verb stack at Request.start (/usr/local/lib/node_modules/npm/node_modules/request/request.js:740:32)
npm verb stack at Request.end (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1398:10)
npm verb stack at end (/usr/local/lib/node_modules/npm/node_modules/request/request.js:567:14)
npm verb stack at Immediate.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:581:7)
npm verb stack at runCallback (timers.js:566:20)
npm verb stack at tryOnImmediate (timers.js:546:5)
npm verb cwd /Users/amohnacs/Developer/git/example-data-sync
npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-verbose"
npm ERR! node v6.3.0
npm ERR! npm v3.10.9
npm ERR! The header content contains invalid characters
进行一些挖掘似乎是一个相当普遍的错误。在测试http请求或空请求时,它可能仅来自请求中的无效标头。它也可能来自为操作系统或服务器设置的错误语言。有人甚至曾说过一个旧的业力依赖导致测试请求中出现无效字符。
我的问题是如何调试此问题,因为我不确定如何在请求失败之前打印标题,我无法在我的项目中包含在请求期间下拉标题的代码,因为标题需要在我的应用程序运行之前成功。
提前致谢。