reza
reza

Reputation: 6358

node.js request package has syntax error

I just installed the latest request package, npm install request. In my app, I have set the NODE_DEBUG=request so now I get a syntax error:

node_modules/request/lib/debug.js

module.exports =
function debug () {
  if (/\brequest\b/.test(process.env.NODE_DEBUG))
    console.error('REQUEST %s', util.format.apply(util, arguments))
}

ReferenceError: util is not defined

Any thoughts on this? What is "util"?

Upvotes: 0

Views: 197

Answers (1)

Pero P.
Pero P.

Reputation: 26992

util is one of the core node.js modules. The file should have a require for the module (var util = require('util')) but it's missing. It's a bug in the request library itself.

It has been fixed but this hasn't been published to the npm repository yet:

https://github.com/mikeal/request/commit/b8cf8743b66d8eee4048561a7d81659f053393c8

Upvotes: 1

Related Questions