Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

module not found error in @angular/platform-server when building fresh Angular 14 project #2686

@fletz

Description

@fletz

Which @angular/* package(s) are the source of the bug?

platform-server

Is this a regression?

No

Description

I've created a new angular project and added only the @nguniversal/express-engine because I want to create a SSR project.

When I try to build the project I get the following errors:

ng build
√ Browser application bundle generation complete.

Warning: PATH_TO_PROJECT\node_modules@angular\platform-server\fesm2020\platform-server.mjs depends on 'domino'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

./node_modules/@angular/platform-server/fesm2020/platform-server.mjs:18:0-27 - Error: Module not found: Error: Can't resolve 'url' in 'PATH_TO_PROJECT\node_modules@angular\platform-server\fesm2020'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

./node_modules/@angular/platform-server/fesm2020/platform-server.mjs:18:0-27 - Error: Module not found: Error: Can't resolve 'url' in 'PATH_TO_PROJECT\node_modules\@angular\platform-server\fesm2020'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
        - install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "url": false }

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 14.0.0
Node: 16.15.1
Package Manager: npm 8.11.0
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1400.0
@angular-devkit/build-angular   14.0.0
@angular-devkit/core            14.0.0
@angular-devkit/schematics      14.0.0
@nguniversal/builders           14.0.0
@nguniversal/express-engine     14.0.0
@schematics/angular             14.0.0
rxjs                            7.5.5
typescript                      4.7.3

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    need: repro stepsWe cannot reproduce the issue with the information given

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions