'/node_modules/.vite/deps/music-metadata.js?v=1aab4cae' does not provide an export named 'parseFile'
See original GitHub issueI’m trying to use this to parse my audio file uploads in Vue3/Vite
and I’m banging my head against a wall with this error:
‘/node_modules/.vite/deps/music-metadata.js?v=1aab4cae’ does not provide an export named ‘parseFile’
my setup is as specified:
import { parseFile } from "music-metadata";
although I can see in the index.js that there’s an export:
export async function parseFile(filePath, options = {}) { ... }
So I’m kinda stuck, any ideas?
Thanks
Issue Analytics
- State:
- Created 10 months ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Misleading error that module does not provide export #32137
cjs' does not provide an export named 'name' which is only "true" because ES modules aren't allowed to import CJS named exports. The...
Read more >"The requested module ' does not provide an export named ...
I have no control over how the api module is built. How can it work in one case but not another? This is...
Read more >Common Error Details - Snowpack
js' does not provide an export named 'YYYYYY'#. If you are using TypeScript, this error could occur if you are importing or exporting...
Read more >Node Modules at War: Why CommonJS and ES ... - Code Red
In ESM scripts, import and export are part of the language; like CJS, they have two different syntaxes for named exports and the...
Read more >the requested module does not provide an export named
To make a named import (which you must do with named exports), ... The thing you want to do is import vue but...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I recommend in to use music-metadata in the main process, as it is designed to run on Node.js. You probably need to use some ElectronJS IPC to trigger parsing and transfer the result back to the renderer.
It also follows the guidance to move heavy computation to the main process.
There are many Electron application having success with that, yet as far as I know only with the CJS version. So if you run into ESM issues in Electron, probably better to switch back to music-metadata v7. Maybe that is why music-metadata-browser works, that depends on v 7, the CJS version.
@Borewit Now I see, thank you.
@LeviticusMaximus I’m using
music-metadata
with Electron, so I solved this one with vite-plugin-electron-renderer:On vue-cli it was:
So I guess you need to set some config to tell your app to run Node packages on client side.