question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'/node_modules/.vite/deps/music-metadata.js?v=1aab4cae' does not provide an export named 'parseFile'

See original GitHub issue

I’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:closed
  • Created 10 months ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Borewitcommented, Dec 19, 2022

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.

1reaction
staniel359commented, Dec 18, 2022

@Borewit Now I see, thank you.

@LeviticusMaximus I’m using music-metadata with Electron, so I solved this one with vite-plugin-electron-renderer:

plugins:
  renderer({
    optimizeDeps: {
      include: [
        'music-metadata'
      ]
    }
  })
]

On vue-cli it was:

configureWebpack: {
  target: 'electron-renderer'
}

So I guess you need to set some config to tell your app to run Node packages on client side.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found