Reputation: 21
I have a docker image running a node process. It is listening to a particular port. When i am trying to access the port using curl or through browser request, I am getting following error -
TypeError: mime.lookup is not a function at ServerResponse.contentType (/E:/Saurabh/node_modules/express/lib/response.js:592:12) at ServerResponse.send (/E:/Saurabh/node_modules/express/lib/response.js:145:14) at app.get (/E:/Saurabh/apis/index.js:26:6) at Layer.handle [as handle_request] (/E:/Saurabh/node_modules/express/lib/router/layer.js:95:5) at next (/E:/Saurabh/node_modules/express/lib/router/route.js:137:13) at Route.dispatch (/E:/Saurabh/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request] (/E:/Saurabh/node_modules/express/lib/router/layer.js:95:5) at /E:/Saurabh/node_modules/express/lib/router/index.js:281:22 at Function.process_params (/E:/Saurabh/node_modules/express/lib/router/index.js:335:12) at next (/E:/Saurabh/node_modules/express/lib/router/index.js:275:10)
If i run same code without docker, then it works as expected. What can be the issue?
Upvotes: 2
Views: 6037
Reputation: 1761
As for npm
documentation on mime
:
Version 2 is a breaking change from 1.x as the semver implies. Specifically:
- lookup() renamed to getType()
If you prefer the legacy version of this module please npm install mime@^1.
Just change the way you call the method to mime.getType(path)
or uninstall mime npm uninstall mime
and reinstall it as npm install mime@^1
.
Upvotes: 3