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

lookup not a function #200

Closed
WilliamRagstad opened this issue Nov 24, 2020 · 1 comment
Closed

lookup not a function #200

WilliamRagstad opened this issue Nov 24, 2020 · 1 comment

Comments

@WilliamRagstad
Copy link

I get the error:

C:\Users\willi\odrive\Google Drive\- KTH\- Kurser\Termin 2\DH2642 Interaktionsprogrammering och dynamiska webben\Projekt\DH2642-Project\node_modules\send\index.js:840
  var type = mime.lookup(path)
                  ^

TypeError: mime.lookup is not a function
    at SendStream.type (C:\Users\willi\odrive\Google Drive\- KTH\- Kurser\Termin 2\DH2642 Interaktionsprogrammering och dynamiska webben\Projekt\DH2642-Project\node_modules\send\index.js:840:19)
    at SendStream.send (C:\Users\willi\odrive\Google Drive\- KTH\- Kurser\Termin 2\DH2642 Interaktionsprogrammering och dynamiska webben\Projekt\DH2642-Project\node_modules\send\index.js:627:8) 
    at onstat (C:\Users\willi\odrive\Google Drive\- KTH\- Kurser\Termin 2\DH2642 Interaktionsprogrammering och dynamiska webben\Projekt\DH2642-Project\node_modules\send\index.js:729:10)
    at FSReqCallback.oncomplete (node:fs:192:5)

On this location

send/index.js

Line 838 in de073ed

var type = mime.lookup(path)

Please change to:

var type;
if (mime.lookup) type = mime.lookup(path)
@dougwilson
Copy link
Contributor

Hi @WilliamRagstad you likely have a node_modules folder that is not correct. You can delete it and run npm install again to fix it, and run npm ls to look for any errors about bad dependencies.

To serve static files the type needs to be there, and if you don't want to use the automatic type lookup, if you set the content-type header yourself, this module will not attempt to look up the type.

WilliamRagstad added a commit to WilliamRagstad/send that referenced this issue Dec 1, 2020
TypeError: mime.lookup is not a function is checked before use.
No difference in functionality but fixes important error for dependent modules.
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

2 participants