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

Mp3 is defined twice causing an error #192

Closed
Tivoli opened this issue Feb 14, 2018 · 9 comments
Closed

Mp3 is defined twice causing an error #192

Tivoli opened this issue Feb 14, 2018 · 9 comments

Comments

@Tivoli
Copy link

Tivoli commented Feb 14, 2018

If you have an issue with a specific extension or type

Locate the definition for your extension/type in the db.json file in the mime-db project. Does it look right?

[ ] No. File a mime-db issue.
[x] Yes: Go ahead and submit your issue/PR here and I'll look into it.

mp3 is defined in both audio/mp3 and audio/mpeg causing the following error:

Error: Attempt to change mapping for "mp3" extension from "audio/mp3" to "audio/mpeg". Pass force=true to allow this, otherwise remove "mp3" from the list of extensions for "audio/mpeg".

@broofa
Copy link
Owner

broofa commented Feb 21, 2018

I'm not seeing it. Please provide a recipe for reproducing.

@Tivoli
Copy link
Author

Tivoli commented Feb 21, 2018

Originally i was importing 'mime/lite', switching back to just 'mime' seems to have resolved the issue for me. Closing this unless I can find a valid reproducible bug.

@Tivoli Tivoli closed this as completed Feb 21, 2018
@Baggz
Copy link

Baggz commented Feb 28, 2018

@Tivoli

Having the same issue. Guess it's related to Webpack evaluating the import 'mime/lite' twice, causing it to import the db twice. Had to switch back to import 'mime' until I figure out how to fix it.

@caub
Copy link

caub commented Apr 3, 2018

I had this issue too (using webpack, and mime/lite@2.2.2)

path/to/server/node_modules/mime/Mime.js:49
        throw new Error(
        ^

Error: Attempt to change mapping for "mp3" extension from "audio/mp3" to "audio/mpeg". Pass `force=true` to allow this, otherwise remove "mp3" from the list of extensions for "audio/mpeg".
    at Mime.define path/to/node_modules/mime/Mime.js:49:15)

It's not easy to reproduce that issue, will try

@broofa
Copy link
Owner

broofa commented Apr 3, 2018

@caub I need a recipe for reproducing this before I can reopen this issue. I'm not seeing any obvious issues in the module itself. (tests are passing, I'm able to require mime and mime/lite and lookup extensions and type w/out issue.)

@caub
Copy link

caub commented Apr 3, 2018

couldn't repeat this error, nevermind then

@jbreckel
Copy link

jbreckel commented Apr 11, 2018

can reproduce this in node repl:

$ node
> var mime = require('mime')
undefined
> var mimelite = require('mime/lite')
Error: Attempt to change mapping for "mp3" extension from "audio/mp3" to "audio/mpeg". Pass `force=true` to allow this, otherwise remove "mp3" from the list of extensions for "audio/mpeg".
    at Mime.define (/path/to/project/node_modules/mime/Mime.js:49:15)
    at new Mime (/path/to/project/node_modules/mime/Mime.js:12:10)
>

@broofa broofa reopened this Apr 11, 2018
broofa added a commit that referenced this issue Apr 11, 2018
@caub
Copy link

caub commented Apr 11, 2018

I found why, we need to copy types/standard.json, either JSON.parse(JSON.stringify(require('./types/standard'))) or something better in both mime and lite

or yea better, avoiding to mutate, like in your fix

@broofa broofa closed this as completed in 5c35df6 Apr 11, 2018
broofa added a commit that referenced this issue Apr 11, 2018
@broofa
Copy link
Owner

broofa commented Apr 11, 2018

published in v2.3

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

5 participants