I tried webrtc demo on my PC. but in demo step-04. When I use npm install and node index.js,it shows "TypeError: mime.lookup is not a function".
even after I installed mime by typing "npm install mime"
How can I fix this and make the demo work?
use mime-type instead of mime. So, Install mime-types first:
npm install mime-types
then make change in your code:
var mime=require('mime-types');
I'm having the same issue with step 4.
You can changing the node-static version from 0.7.7 to 0.7.10 in package.json and rerunning npm install
"dependencies": {
"node-static": "0.7.10",
"socket.io": "1.2.0" }
if you have a folder "node modules" in your root directory,delete that and type npm cache clear and then type npm install.this should work fine
I have the same issue but then try to use mime ~1.2.7 and i think this will work fine. just change your version of mime in package.json file and install it.
change mime.lookup(type) to mime.getType(type)
As @HRISHABH RAJ mentioned you want to reference mime-type instead of mime however you should check your node_modules folder first to see if the package is already installed.
来源:https://stackoverflow.com/questions/46420905/webrtc-error-with-mime-lookup