webrtc error with mime.lookup

╄→尐↘猪︶ㄣ 提交于 2019-12-06 01:55:45

问题


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?


回答1:


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');



回答2:


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" }



回答3:


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




回答4:


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.




回答5:


change mime.lookup(type) to mime.getType(type)




回答6:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!