I am trying to use franc package but everytime i try to run it this error appears " The requested module 'franc' does not provide an export named 'default' " and i don't know what it means. I've tried changing the filename to mjs or adding "type"="module" in package.json but that only gives me this error, I can't find any solution online.
Note: --experimental-modules does not work( it says '\302\226 npm': command not found)
This is the js file(i added "type"="module" to package.json)
import franc from 'franc';
console.log(franc('Hi, I speak english!'));
This is package.json
{
"name": "curs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"franc": "^6.0.0",
"lang": "^0.1.1"
}
}
PS: Ignore lang my point is just to make franc run in the first place.
That means that the package has no export like export default ...
but you are trying to import it like if it had. Indeed, when you provide a name without surrounding curly braces, it means that you want to import a default export and give it your own name.
The library you are trying to import actually has an export like this export function franc() { //... }
, so you need to import it like this:
import { franc } from 'franc';