-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find module environments/environment #734
Comments
Never mind, it seems the problem is that although for client side rendering the line: and by the way, I don't know why but by default for server-side rendering it will pick the PROD environment file..
|
Yup @iberodev is right, server side and client side do not have the same environment. |
Server side rendering works flawlessly on my local machine. But when i try to push to heroku and build i get TS2307: Cannot find module '../../../environments/environment'. The relative path is perfectly right and works in my local machine. Env in angular-cli.json is the same for both server side and client side app.
I have gitignored my environments/environment.ts so each of our developers can use their own copy of it. This used to work fin until i moved to universal. Could this be the culprit ? |
@abhijithmannath did you ever find a solution to this? |
@iberodev |
try this import {environment} from 'src/environments/environment'; |
Facing the same issue. :( |
Have any of you tried to include in it in the paths from the tslint.config file ? |
I had to change the tsconfig.server.json basepath from |
This is just nuts, it works fine on my computer at work but my laptop won't compile the server. |
Check if your local machine has any ~/.tsconfig.json file that is using by default, and which the server might lack. |
Just happened to me after upgrading to Angular 7.2.8 & CLI 7.3.5. Downgrading to 7.2.0 solves this but a proper solution is required. |
try: |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Note: for support questions, please use one of these channels: https://github.com/angular/universal/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports. Also, Preboot has moved to https://github.com/angular/preboot - please make preboot-related issues there.
Do you want to request a feature or report a bug?
No
What is the current behavior?
When using nodeJs server side rendering it cannot compile because it cannot find the module
environment
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem by creating a github repo.
I followed steps here and after that I tried to use environments as described here
What is the expected behavior?
It should work same as if I use
ng serve
and my app should have access to the specified environment propertiesWhat is the motivation / use case for changing the behavior?
Being able to use angular universal and environments
Please tell us about your environment:
Error:
My
server.ts
The simple service that tries to access environments
auth.service.ts
:The text was updated successfully, but these errors were encountered: