-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
musicMetadata.parseFile is not a function #2328
Comments
esm 导入 |
Same issue ^10.7.0 This is documented in API section at npmjs. |
问题已解决了,将整个项目模块作为esm导入就行了 |
This import works for functionality but the typescript is off: import * as mm from 'music-metadata'
const {parseFile} = mm I'm running this under a bash file as follows: #!/usr/bin/env jiti
// ... see jiti The complexity of all this is beyond me, but the author of unjs has many projects with imports. I noticed they all seam to have some sort of build step though. |
Actually, |
我使用的是js,在package.json增加
"tupe":"module"后,一切正常,即把项目作为esm导入
…---Original---
From: ***@***.***>
Date: Thu, Jan 23, 2025 02:44 AM
To: ***@***.***>;
Cc: ***@***.***>;"State ***@***.***>;
Subject: Re: [Borewit/music-metadata] musicMetadata.parseFile is not afunction (Issue #2328)
Actually, import {parseFile} from 'music-metadata' works as well. It is only typescript that is not working; again, under unjs/jitsi..
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
set up"type": "module"later You need to import other previously imported packages by esm module.
That's how I solved it. Maybe you should reinstall music-metadata.
…---Original---
From: ***@***.***>
Date: Thu, Jan 23, 2025 03:18 AM
To: ***@***.***>;
Cc: ***@***.***>;"State ***@***.***>;
Subject: Re: [Borewit/music-metadata] musicMetadata.parseFile is not afunction (Issue #2328)
Thank you.. All your replies look like this to me:
image.png (view on web)
But I can read the post at the top.
Yes, I do have "type": "module" in my package.json and I made sure to Restart the TS Server. What is interesting is, it is not all methods:
image.png (view on web)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
What is the error given by the IDE? Move the mouse to the red wavy line.
…---Original---
From: ***@***.***>
Date: Thu, Jan 23, 2025 03:18 AM
To: ***@***.***>;
Cc: ***@***.***>;"State ***@***.***>;
Subject: Re: [Borewit/music-metadata] musicMetadata.parseFile is not afunction (Issue #2328)
Thank you.. All your replies look like this to me:
image.png (view on web)
But I can read the post at the top.
Yes, I do have "type": "module" in my package.json and I made sure to Restart the TS Server. What is interesting is, it is not all methods:
image.png (view on web)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
About sending the garbled language in the past, it may be due to Chinese or my local mailbox.
…---Original---
From: ***@***.***>
Date: Thu, Jan 23, 2025 03:18 AM
To: ***@***.***>;
Cc: ***@***.***>;"State ***@***.***>;
Subject: Re: [Borewit/music-metadata] musicMetadata.parseFile is not afunction (Issue #2328)
Thank you.. All your replies look like this to me:
image.png (view on web)
But I can read the post at the top.
Yes, I do have "type": "module" in my package.json and I made sure to Restart the TS Server. What is interesting is, it is not all methods:
image.png (view on web)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
The error is:
I removed node_modules then re-installed via |
Remember to import all imported modules by esm. If you do, it should be no problem. If the program still can't run, you can try to clear the cache of pnpm. My time here is already 3:33.It's time for me to go to bed. If you haven't solved it tomorrow, I will help you, because I don't use the computer now.
…---Original---
From: ***@***.***>
Date: Thu, Jan 23, 2025 03:27 AM
To: ***@***.***>;
Cc: ***@***.***>;"State ***@***.***>;
Subject: Re: [Borewit/music-metadata] musicMetadata.parseFile is not afunction (Issue #2328)
The error is:
Module '"music-metadata"' has no exported member 'parseFile'.ts(2305)
import parseFile
I removed node_modules then re-installed via pnpm install..
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
For importing music-metadata in a CommonJS / TypeScript project, check: music-metadata README: CommonJS backward compatibility. |
Is there an existing issue for this?
music-metadata version
10.7.0
Current Behavior
Error using parseFile
musicMetadata.parseFile is not a function
code:
An error occurs when calling this code
Expected Behavior
No response
Attached audio sample?
The text was updated successfully, but these errors were encountered: