Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

231
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!