NestJS Monorepo Microservices - Cannot find module '@work/contracts/dist/adresses' or its corresponding type declarations

Viewed 288

I'm trying to build a NestJS Monorepo service using Microservices architecture and TypeScript as primary language. The monorepo project consists of two microservice apps - 'work' and 'workers'. The 'work' service app is meant to power the 'workers' app that exists in the same NestJS monorepo project.

The problem is, when I start the 'work' app and try running the 'workers' app, it doesn't recognize the existence of the 'work' app or its path, and thus fails to run.

I get the error below.

src/application/work/load-address.ts:4:41 - error TS2307: Cannot find module '@work/contracts/dist/adresses' or its corresponding type declarations.

I'm using 'npm run start' to run the 'workers' app.

Thanks in advance!

The 'work' package.json file looks like this:

{
  "name": "@work/create",
  "version": "0.0.1",
  ...
  ...
}

The 'workers' package.json file looks like this:


{
  "name": "@workers/contracts",
  "version": "0.0.1",
  ...
  ...
}

And I import 'work' into 'workers' like this:


import { ADDRESS } from '@work/contracts/dist/adresses'; 

0 Answers
Related