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

Missing ./Mime #175

Closed
inlet opened this issue Oct 15, 2017 · 6 comments
Closed

Missing ./Mime #175

inlet opened this issue Oct 15, 2017 · 6 comments

Comments

@inlet
Copy link

inlet commented Oct 15, 2017

Package is broken. Seems that ./Mime is missing.

> mime = require('mime')
Error: Cannot find module './Mime'
@broofa
Copy link
Owner

broofa commented Oct 15, 2017

Works for me. I'm not seeing other reports of this issue, either. :-/

What version of node?
What version of npm?
What version of mime are you working with?


kieffer@MacBook-Pro-3$ ls -Fla
total 0
drwxr-xr-x   2 kieffer  wheel   68 Oct 12 15:41 ./
drwxrwxrwt  28 root     wheel  952 Oct 15 03:50 ../

kieffer@MacBook-Pro-3$ npm install mime
npm WARN saveError ENOENT: no such file or directory, open '/private/tmp/foo/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/private/tmp/foo/package.json'
npm WARN foo No description
npm WARN foo No repository field.
npm WARN foo No README data
npm WARN foo No license field.

+ mime@2.0.3
added 1 package in 0.776s

kieffer@MacBook-Pro-3$ ls -Fla
total 8
drwxr-xr-x   4 kieffer  wheel  136 Oct 15 03:50 ./
drwxrwxrwt  28 root     wheel  952 Oct 15 03:50 ../
drwxr-xr-x   4 kieffer  wheel  136 Oct 15 03:50 node_modules/
-rw-r--r--   1 kieffer  wheel  305 Oct 15 03:50 package-lock.json

kieffer@MacBook-Pro-3$ node
> const mime = require('mime')
undefined
>
kieffer@MacBook-Pro-3$ ls -Fla node_modules/mime/Mime.js
-rw-r--r--  1 kieffer  wheel  1910 Sep 25 11:38 node_modules/mime/Mime.js

kieffer@MacBook-Pro-3$

@inlet
Copy link
Author

inlet commented Oct 15, 2017

Thats odd.. when I install it in a clean folder it works indeed..

When I try to add it to my project the ./Mime is missing:

> yarn add mime --dev
yarn add v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
└─ mime@2.0.3
Done in 6.03s.

> l node_modules/mime
 .eslintrc.json
 .github
 CHANGELOG.md
 LICENSE
 README.md
 cli.js
 index.js
 lite.js
 package.json
 src
 types

@inlet
Copy link
Author

inlet commented Oct 15, 2017

But it's there alright: https://unpkg.com/mime@2.0.3/

Never had this issue before, something todo with my current project I guess.

I noticed that it works using npm npm install mime --save-dev, but not with yarn.

Anyway, I think your setup is totally fine. Let's close this issue?

Cheers

@inlet
Copy link
Author

inlet commented Oct 15, 2017

I think I might have found the problem..

I use webpack-dev-middleware and it uses mime@1.3.4. Somehow yarn doesn't resolve it and returns the old package.

Thanks for your fast reply though!

@broofa
Copy link
Owner

broofa commented Oct 15, 2017

Glad you [sort of] got this figured out.

@broofa broofa closed this as completed Oct 15, 2017
@mfn
Copy link

mfn commented Oct 13, 2020

I faced this problem too today whilst trying to upgrade a very old NodeJS project (also from 2017, incidentally).

I don't even use mime directly (apologies 😄) but it's a third party dependency somewhere.

I used yarn upgrade-interactive --latest to upgrade all the packages, but eventually due to existing yarn.lock I would always get that error.

The "fix" for me was to remove yarn.lock and let yarn sort out all the dependencies from scratch. It did not matter for this project as the goal was to upgrade all dependencies anyway.

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

3 participants