Cannot find module '../config'


#1

I’m following the NativeScript Grocery tutorial with angular and all good up to Chapter 3 in the part that I have to add an angular service, everything else should be but compile me showing: error TS2307: Can not find module ‘…/config’ .

I did not find how to solve that problem please help.


#2

is there a config.ts file in place? I can’t quite tell from your screenshot.


#3

To the point where I get in the tutorial does not tell me anything to create a config.ts file: /, I leave the link of the tutorial I followed.
https://docs.nativescript.org/angular/tutorial/ng-chapter-3.html#34-services


#4

I see it referenced in chapter 2, in /shared. Maybe change the path?


#5

You should have a config.ts file in your project where he defines the url of the API that the service is going to connect.

Make sure you have this file, if you don’t you can just include it i think


#6

You are right in Chapter 2 make a mension of that file but I know there must be a variable apiUrl inside but I do not know exactly how the code was, I just created a config.ts file but I do not know what I should actually go inside. I attached a capture of my folder structure, the config.ts file I created it but it does not contain anything and now it shows me the error of the variable, but I already recognize the import.


#7

I already created the config.ts file inside the shared folder but I do not know what code exactly has to go inside can you help me? I followed the tutorial of nativescript with agular chapter 3 of the services but they do not speak of that file. I attach a capture of my folder structure, I created the config file already recognizes the import but it gives me the following error.


#8

I took another look at the instructions. Once you clone the initial groceries repo via tns create Groceries --template nativescript-template-ng-groceries the /shared folder is created and you have a config file ready for you. It’s here: https://github.com/tjvantoll/nativescript-template-ng-groceries/blob/master/shared/config.ts


#9

I created the project from visual studio code and when I did I did not get exactly the folder structure as the tutorial shows, for example the shared folder was not created that is why I create it manually and inside I put the file config.ts but now I Shows another error


#10

hi, I fear you missed the step in Chapter 2 where you’re supposed to clone the Groceries repo and get the appropriate files. You’re going to have trouble if you create a new app without that folder structure and try to get through the tutorial. I recommend going back and cloning the repo, then starting the tutorial again.