Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webrtc error with mime.lookup

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?

like image 653
Phi Avatar asked Sep 26 '17 08:09

Phi


4 Answers

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');
like image 163
HRISHABH RAJ Avatar answered Nov 13 '22 02:11

HRISHABH RAJ


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" }
like image 4
jaemin Avatar answered Nov 13 '22 01:11

jaemin


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

like image 2
Md Abu aslam Avatar answered Nov 13 '22 01:11

Md Abu aslam


Try deleting node_modules and running npm i and npm start.

If the problem still exists try doing npm update --legacy-peer-deps and rerun your application.

like image 1
Arhan Choudhury Avatar answered Nov 13 '22 03:11

Arhan Choudhury