Cannot find module



(Starting note : I am very new to all the NativeScript, TypeScript, Angular thingy not much work in this except helloworld kinda ),

For this issue I spent a day and half trying to figure this out besides searching around ofcourse and trying whatever was suggested

From the beginning what I did :
Created project using
tns create projectname --template
tns plugin add nativescript-snackbar

And coz I needed a login/register stuff, I added the following files.

mkdir -p app/components/login
touch app/components/login/login.component.ts
touch app/components/login/login.component.html

mkdir -p app/components/register
touch app/components/register/register.component.ts
touch app/components/register/register.component.html
Made changes so that I first register/login (that I created) and then go to ‘home’ that is generated from the first command.

So far so good. Problem starts when I try to change in app-routing.module.ts where originally I have { path: "featured", loadChildren: "./featured/featured.module#FeaturedModule" },
I thought of using

{ path: "featured", component: FeaturedComponent },

(as I dont want them as children, but as individual components)For which I added

import { FeaturedComponent } from "./components/featured/featured.component";

And I got

Found peer TypeScript 2.4.2
app/app.module.ts(10,35): error TS2307: Cannot find module './components/featured/featured.component'.

What I have tried:
All kinds of stunds of closing vscode and closing sessions of ‘file watching’.
apart from this I tried removing platform android and installing, and also rm -rf platforms node_modules hooks and then tns install and many suggestions that I can possibly find for module not found kind of issues.

Any suggestions?


Did you by any chance delete the FeaturedModule? and did you add FeaturedComponent to the declarations within AppModule as well as remove FeaturedModule from imports?


Sorry here…for some reason the featured had not been created in the components folder (as I thought looking at the other components) and hence the confusion.
In short, path itself was bad (very silly ‘newbie in this framework’ mistake as admitted right in the beginning of my first post). Thanks to all who tried to help here and in slack!