Can not import the library
See original GitHub issueBug description I can not import the package from node. I spent 10h.
Expected behavior
The package is imported and I can use the parseFile
function.
Audio file demonstrating the problem
~/music-metadata
❯ npm i music-metadata
added 17 packages, and audited 18 packages in 1s
8 packages are looking for funding
run npm fund
for details
found 0 vulnerabilities
~/music-metadata-test
❯ node
Welcome to Node.js v18.4.0.
Type ".help" for more information.
> require('music-metadata')
Uncaught:
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/janwirth/music-metadata/node_modules/music-metadata/lib/index.js not supported.
Instead change the require of index.js in null to a dynamic import() which is available in all CommonJS modules.
at __node_internal_captureLargerStackTrace (node:internal/errors:477:5)
at new NodeError (node:internal/errors:388:5)
at Module._extensions..js (node:internal/modules/cjs/loader:1139:19)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Module._load (node:internal/modules/cjs/loader:834:12)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:102:18) {
code: 'ERR_REQUIRE_ESM'
}
Issue Analytics
- State:
- Created a year ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Cannot import Python Libraries anywhere - Super User
I am on MacOS 10.14.5. I currently cannot import any Python third-party Library from anywhere (including VSCode, Pycharm and terminal). Detail.
Read more >Can't import my own modules in Python - Stack Overflow
In your particular case it looks like you're trying to import SomeObject from the myapp.py and TestCase.py scripts. From myapp.py, do import SomeObject....
Read more >How to Fix ImportError: Cannot Import Name in Python - Rollbar
The Python ImportError: cannot import name error occurs when an imported class is not accessible or is in a circular dependency.
Read more >5. The import system — Python 3.11.1 documentation
When a module is first imported, Python searches for the module and if found, it creates a module object 1, initializing it. If...
Read more >Resolve "Unable to import module" errors from Python ... - AWS
Important: Make sure that you put the library that you import for Python inside the /python folder. Resolution. Note: The following steps show ......
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
Downgrading to version 7 solved it for me.
The lack of backward compatibility in ESM modules is a true nightmare @janwirth.