Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

232
Vistas
can not find module TypeScript error message?

I created a TypeScript's class and published it on npm
https://www.npmjs.com/package/mds.persian.calendar

I installed it in a Angular project as the following command:
npm install mds.persian.calendar --save

It installed successfully, and I can see the mds.persian.calendar folder in node_modules folder but when I want to use it in my TypeScript file as the following code, it alert can not find module
import { MdsPersianCalendar } from 'MdsPersianCalendar';

How should I use it?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

In mds.persian.calendar/package.json this config is missing:

{
    ...
    "main": "./mds.persian.calendar.js",
    "types": "./mds.persian.calendar.d.ts"
}

That's why you need to reference this module relative e.g. like this

//./wwwroot/ts/main.ts

// This doesn't work
//import { MdsPersianCalendar } from 'mds.persian.calendar';

import { MdsPersianCalendar } from '../../node_modules/mds.persian.calendar/mds.persian.calendar';

let calendar = new MdsPersianCalendar();
calendar.now
over 4 years ago · Santiago Trujillo 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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda