Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the reason of "Cannot find module" for nrwl modules?

I use nrwl.io in my project.

I created several libs:

ng g lib rest //ok
ng g lib services //ok
ng g lib models //created ok, but "Cannot find module " later on!

All of these libs were successfully created, but when I try to import my models lib I see error "Cannot find module":

import { ModelA, ModelB } from '@myproj/models'; //Cannot find module '@myproj/models'

The question is: How and where I can check if my '@myproj/models' was properly registered?

P.S. I can see "models" module in nx.json, angular.json and tsconfig.json. And I can see no difference with other modules.

P.P.S. I use "@nrwl/nx": "6.1.0" and "@nrwl/schematics": "6.1.0"

like image 457
Sergei Panfilov Avatar asked Aug 30 '18 08:08

Sergei Panfilov


1 Answers

In my case it was because I was dumb and didn't restart my TypeScript server in VS Code:

CMD / CTRL + SHIFT + P
>TypeScript: Restart TS Server
like image 55
vwos Avatar answered Oct 24 '22 08:10

vwos