Rasheek Mohamed
Rasheek Mohamed

Reputation: 216

Cannot find module 'src/environments/environment' in Ionic projec

When running ng-serve in my ionic project, I get the below error,

ERROR in src/app/home/home.service.ts:7:29 - error TS2307: Cannot find module 'src/environments/environment'.

7 import { environment } from 'src/environments/environment';

I am using Angular 7 and Ionic 4, And since i am new to Ionic. Can anyone help me out

I have tried changing 'environments/environment' by 'src/environments/environment' , running npm run env , running import { environment } from '../environments/environment'; and nothing worked. Thank you

My environment.prod.ts

export const environment = {
  production: true,
  baseApi: 'http://api.aladhan.com/v1/'
};

My environment.ts

export const environment = {
  production: false,
  baseApi: 'http://api.aladhan.com/v1/'
};

Upvotes: 1

Views: 6312

Answers (2)

augustino
augustino

Reputation: 559

Simply, inside the angular src folder, create enviroments folder and add environment.ts file. In that file, paste the followingexport const environment = {}now you can install angular fire using ng add @angular/fire

Upvotes: 0

kanpinar
kanpinar

Reputation: 133

Just look for tsconfig.json file

You can add Path definition for this kindo folders.. they usually start with @

And ends with '/*' and ad a parameter path takes an array like for example

"compilerOptions": { "paths": { "@environments/*": ["environments/*"], ...

for extra "resolveJsonModule": true, parameter sometimes usefull

regards.

Upvotes: 1

Related Questions