• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

201
Vistas
The requested module 'franc' does not provide an export named 'default'

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.

almost 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

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';
almost 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda