Express app throws 500 TypeError: Object # <EventEmitter> has no 'hrtime' method

An error occurs in the staging instance of my webapp:

Express
500 TypeError: Object #<EventEmitter> has no method 'hrtime'
   at Object.logger [as handle] (F:\approot\node_modules\express\node_modules\connect\node_modules\morgan\index.js:96:28)
   at next (F:\approot\node_modules\express\node_modules\connect\lib\proto.js:169:15)
   at Object.favicon [as handle] (F:\approot\node_modules\express\node_modules\connect\node_modules\serve-favicon\index.js:54:44)
   at next (F:\approot\node_modules\express\node_modules\connect\lib\proto.js:169:15)
   at Object.expressInit [as handle] (F:\approot\node_modules\express\lib\middleware.js:30:5)
   at next (F:\approot\node_modules\express\node_modules\connect\lib\proto.js:169:15)
   at Object.query [as handle] (F:\approot\node_modules\express\node_modules\connect\lib\middleware\query.js:43:5)
   at next (F:\approot\node_modules\express\node_modules\connect\lib\proto.js:169:15)
   at Function.handle (F:\approot\node_modules\express\node_modules\connect\lib\proto.js:177:3)
   at Server.app (F:\approot\node_modules\express\node_modules\connect\lib\connect.js:66:37)

      

Line 96 in morgan / index.js:

req._startAt = process.hrtime();

      

This only happens on the copy we have deployed to Azure. We can run Express Server through node directly on the machine and everything works fine.

We've just started this problem with the most recent deployment. Any idea where to start looking? I can't seem to find similar issues related to Github issues for Express or Morgan. Google doesn't help either.

+3


source to share


2 answers


process.hrtime()

only exists in node v0.8.x and newer. So you need to somehow upgrade to a newer version of node (latest stable release).



+4


source


This is due to the version. Try updating to the current version. Here are some alternatives for how to make the change.



https://blogs.msdn.microsoft.com/azureossds/2016/04/20/nodejs-and-npm-versions-on-azure-app-services/

-1


source







All Articles