Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mime.lookup is not a function #4134

Closed
ghost opened this issue Nov 8, 2017 · 10 comments
Closed

mime.lookup is not a function #4134

ghost opened this issue Nov 8, 2017 · 10 comments

Comments

@ghost
Copy link

ghost commented Nov 8, 2017

my os is windows 8.1 64 bit
this is the following error

CRASH: TypeError: mime.lookup is not a function
    at Server.respond (C:\Users\inky\Music\pokemon-showdown\node_modules\node-st
atic\lib\node-static.js:348:28)
    at C:\Users\inky\Music\pokemon-showdown\node_modules\node-static\lib\node-st
atic.js:64:22
    at FSReqWrap.oncomplete (fs.js:155:5)

Additional information:

here is the following logs

inky@Shousto4 MINGW64 ~/Music/pokemon-showdown (master)
$ node pokemon-showdown
NEW GLOBAL: global
NEW CHATROOM: lobby
NEW CHATROOM: staff
Worker 1 now listening on 0.0.0.0:8000
Test your server at http://localhost:8000

CRASH: TypeError: mime.lookup is not a function
    at Server.respond (C:\Users\inky\Music\pokemon-showdown\node_modules\node-st
atic\lib\node-static.js:348:28)
    at C:\Users\inky\Music\pokemon-showdown\node_modules\node-static\lib\node-st
atic.js:64:22
    at FSReqWrap.oncomplete (fs.js:155:5)

Additional information:

it happended when i went on http://localhost:8000

@Zarel
Copy link
Member

Zarel commented Nov 8, 2017

My best guess is that this is a bug in node-static's Windows support?

@Zarel
Copy link
Member

Zarel commented Nov 8, 2017

Looking further, it seems like either you're missing a subdependency, or you have the wrong version of mime.

Try deleting node_modules and trying again?

@Zarel Zarel closed this as completed Nov 8, 2017
@Zarel
Copy link
Member

Zarel commented Nov 8, 2017

(Feel free to reopen if that doesn't work)

@ghost
Copy link
Author

ghost commented Nov 8, 2017

@Zarel changing mime.lookup to mime.getType in the code worked so thanks anywayws, also restarting my computer also fixed it

@Zarel
Copy link
Member

Zarel commented Nov 8, 2017

That definitely means you have the wrong version of mime. Are you using a third party npm implementation? The default one should install mime 1, not mime 2...

@ghost
Copy link
Author

ghost commented Nov 10, 2017

i just did npm install i belive npm is installing the lastest version but after i restarted my pc it stopped showing that error so i think its a web error or something

@Zarel
Copy link
Member

Zarel commented Nov 10, 2017

Let's just chalk it up to a one-time npm glitch.

@HoeenCoder
Copy link
Member

Are you using c9? I've expirienced this in the past trying to connect (link didnt redirect to psim.us) its easily fixed by adding -80.psim.us to the normal link (if it dosent already have it)

@Morfent
Copy link
Contributor

Morfent commented Nov 13, 2017

What versions of node, npm, node-static, and mime are installed if this happens for you, out of curiosity?

Are you using c9? I've expirienced this in the past trying to connect (link didnt redirect to psim.us) its easily fixed by adding -80.psim.us to the normal link (if it dosent already have it)

The only reason that prevents the crash is because using the psim.us URL skips having to get index.html from the server to get redirected. Any requests to the server outside of /showdown/* should still crash

@hawm
Copy link

hawm commented Oct 11, 2018

lookup() renamed to getType() in mime version 2. https://www.npmjs.com/package/mime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants