Skip to content

Error: [vite] cannot find entry point module 'file://...' on Windows with SSR #29424

Closed

Description

@alan-agius4

I updated all my projects to use "@angular/core": "19.1.2" & "@angular/cli": "19.1.3". But now when I start the dev server using "ng serve" and visit the localhost:4200, the nodejs server crashes with the following error:

`
NOTE: Raw file sizes do not reflect development server per-request transformations.
➜ Local: http://localhost:4200/
➜ press h + enter to show help
node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^

Error: [vite] cannot find entry point module 'file:///D:/<PROJECT_FOLDER>/.angular/vite-root/spa-near-me/@ng/component?c=src%2Fapp%2Fcomponents%2Fheader%2Fheader.component.ts%40HeaderComponent&t=1737401566323'.
at fetchModule (file:///D:/<PROJECT_FOLDER>/node_modules/@angular/build/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:51477:13)
at async handleInvoke (file:///D:/<PROJECT_FOLDER>/node_modules/@angular/build/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:44166:22)
at async EventEmitter.listenerForInvokeHandler (file:///D:/<PROJECT_FOLDER>/node_modules/@angular/build/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:44239:19) {`

All my projects are using tailwind CSS and I've also enabled provideExperimentalZonelessChangeDetection() .

This problem goes away if I use ng serve --no-hmr.

Here are my dependencies
"dependencies": { "@angular/animations": "^19.1.2", "@angular/common": "^19.1.2", "@angular/compiler": "^19.1.2", "@angular/core": "^19.1.2", "@angular/forms": "^19.1.2", "@angular/platform-browser": "^19.1.2", "@angular/platform-browser-dynamic": "^19.1.2", "@angular/platform-server": "^19.1.2", "@angular/router": "^19.1.2", "@angular/ssr": "^19.1.3", "express": "^4.18.2", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.15.0" }, "devDependencies": { "@angular-devkit/build-angular": "^19.1.3", "@angular/cli": "^19.1.3", "@angular/compiler-cli": "^19.1.2", "@types/express": "^4.17.17", "@types/jasmine": "~5.1.0", "@types/node": "^18.18.0", "autoprefixer": "^10.4.20", "daisyui": "^4.12.23", "jasmine-core": "~5.5.0", "karma": "~6.4.0", "karma-chrome-launcher": "~3.2.0", "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", "lucide-angular": "^0.473.0", "postcss": "^8.5.1", "prettier": "^3.4.2", "tailwindcss": "^3.4.17", "typescript": "~5.7.2", "xmlbuilder": "^15.1.1" }

Originally posted by @rabikr in #59602

Activity

  1. self-assigned this
    on Jan 20, 2025
  2. changed the title [-]Error: [vite] cannot find entry point module 'file:///D:/<PROJECT_FOLDER>/.angular/vite-root/spa-near-me/@ng/component?c=src%2Fapp%2Fcomponents%2Fheader%2Fheader.component.ts%40HeaderComponent&t=1737401566323' on Windows[/-] [+]`Error: [vite] cannot find entry point module 'file:///D:/<PROJECT_FOLDER>/.angular/vite-root/spa-near-me/@ng/component?c=src%2Fapp%2Fcomponents%2Fheader%2Fheader.component.ts%40HeaderComponent&t=1737401566323'`on Windows[/+] on Jan 20, 2025
  3. atsjo commented on Jan 21, 2025

    @atsjo

    similar problem for me... I think 'angular-calendar' is including the problematic import in my repo, never had a problem with it before. It works with latest cli (19.1.3), but not with latest angular (19.1.2). Downgrading angular to 19.1.1 fixes it...

    [vite] Pre-transform error: Failed to resolve import "angular-draggable-droppable" from ".angular/vite-root/devtest/main.js". Does the file exist?
    Plugin: vite:import-analysis
    File: D:/repos/teve-no/task4s/.angular/vite-root/devtest/main.js:6386:23
    6384| import * as i79 from "@angular/material/icon";
    6385| import * as i87 from "angular-calendar";
    6386| import * as i96 from "angular-draggable-droppable";
    | ^
    6387| import * as i104 from "angular-resizable-element";
    6388| function tvCalendarComponent_Case_25_Template(rf, ctx)

  4. Laffery commented on Jan 21, 2025

    @Laffery

    +1

  5. added a commit that references this issue on Jan 21, 2025
    5982aa3
  6. Nevada-Way commented on Jan 21, 2025

    @Nevada-Way

    I created a new deafult app, only ( just html hello ) and when i ran ng serve got same error:
    Error: [vite] cannot find entry point module 'file:///D:/0.Create/Angular/ssr-hello/ssrhello/.angular/vite-root/ssrhello/@ng/component?c=src%2Fapp%2Fapp.component.ts%40AppComponent&t=1737451488230'.
    at fetchModule (file:///D:/0.Create/Angular/ssr-hello/ssrhello/node_modules/@angular/build/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:51477:13)
    at async handleInvoke (file:///D:/0.Create/Angular/ssr-hello/ssrhello/node_modules/@angular/build/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:44166:22)
    at async EventEmitter.listenerForInvokeHandler (file:///D:/0.Create/Angular/ssr-hello/ssrhello/node_modules/@angular/build/node_modules/vite/dist/node/chunks/dep-BJP6rrE_.js:44239:19) {
    runnerError: Error: RunnerError
    at reviveInvokeError (file:///D:/0.Create/Angular/ssr-hello/ssrhello/node_modules/@angular/build/node_modules/vite/dist/node/module-runner.js:541:18)
    at Object.invoke (file:///D:/0.Create/Angular/ssr-hello/ssrhello/node_modules/@angular/build/node_modules/vite/dist/node/module-runner.js:624:15)
    }

    using ng serve --no-hmr bypasses this error because I beleive the source of the issue is in the Hot Module Replacement (HMR)

  7. added 2 commits that reference this issue on Jan 21, 2025
    ff8192a
    abb186a
  8. changed the title [-]`Error: [vite] cannot find entry point module 'file:///D:/<PROJECT_FOLDER>/.angular/vite-root/spa-near-me/@ng/component?c=src%2Fapp%2Fcomponents%2Fheader%2Fheader.component.ts%40HeaderComponent&t=1737401566323'`on Windows[/-] [+]`Error: [vite] cannot find entry point module 'file://...'` on Windows[/+] on Jan 21, 2025
  9. changed the title [-]`Error: [vite] cannot find entry point module 'file://...'` on Windows[/-] [+]`Error: [vite] cannot find entry point module 'file://...'` on Windows with SSR[/+] on Jan 21, 2025
  10. ahmedmohamedrashad01 commented on Jan 22, 2025

    @ahmedmohamedrashad01

    I have the same issue, but if I run this command ng s -o --no-hmr
    the app is working fine without any issue

  11. quedicesebas commented on Jan 24, 2025

    @quedicesebas

    Not fixed for me.

  12. alan-agius4 commented on Jan 24, 2025

    @alan-agius4
    CollaboratorAuthor

    @quedicesebas please provide the output of ng version.

  13. quedicesebas commented on Jan 24, 2025

    @quedicesebas

    @quedicesebas please provide the output of ng version.

    Angular CLI: 19.1.4
    Node: 20.15.0
    Package Manager: npm 10.8.1
    OS: win32 x64

    Angular: 19.1.3
    ... animations, common, compiler, compiler-cli, core, forms
    ... localize, platform-browser, platform-browser-dynamic
    ... platform-server, router

    Package Version

    @angular-devkit/architect 0.1702.3
    @angular-devkit/build-angular 19.1.4
    @angular-devkit/core 17.2.3
    @angular-devkit/schematics 19.1.4
    @angular/cli 19.1.4
    @angular/fire 19.0.0
    @angular/google-maps 19.1.1
    @angular/ssr 19.1.4
    @schematics/angular 19.1.4
    rxjs 7.8.1
    typescript 5.6.3
    zone.js 0.15.0

    But correction. The error is not shown, but the app is not loading, showing Cannot GET / in the browser. If I press F5 (reload), loads normally :S

  14. alan-agius4 commented on Jan 24, 2025

    @alan-agius4
    CollaboratorAuthor

    @quedicesebas, that seems unrelated to this, we haven’t had similar reports. Please file a new issue with a minimal reproduction. Thanks.

  15. gnibeda commented on Jan 27, 2025

    @gnibeda

    Maybe I have a different case. I need SSR only for prod build, but not in dev mode.
    In my case I've got the same error due to CLI trying to access src/main.server.ts with disabled SSR.

    Solved it by moving "server": "src/main.server.ts", to production configuration.

    Details:
    in angular.json I've set ssr to false for development configuration:

    "development": {
        "ssr": false,
    

    CLI still tries to access src/main.server.ts (why in the name of god, if ssr is disabled in configuration???)

    So I've moved "server": "src/main.server.ts", from architect/build/options to architect/build/configurations/production.
    Now ng serve works fine and doesn't try to access src/main.server.ts.

  16. CarlosTorrecillas commented on Feb 3, 2025

    @CarlosTorrecillas
    Contributor

    @gnibeda Thanks, that worked for me! It looks like if you have disabled SSR you have to move the related configuration to the section that is really using it, PROD. I had the exact same use case and it now works

  17. angular-automatic-lock-bot commented on Mar 6, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  18. locked and limited conversation to collaborators on Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions