Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

233
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda