Skip to content

Commit 150ed2b

Browse files
alan-agius4thePunderWoman
authored andcommitted
docs: add documentation for NG0401 error (#63947)
PR Close #63947
1 parent d0c7ea8 commit 150ed2b

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Missing Platform
2+
3+
Angular requires a platform to be initialized. This error is thrown when `bootstrapApplication` is used on the server without providing a `BootstrapContext`.
4+
5+
When using server-side rendering, `bootstrapApplication` requires a `BootstrapContext` to be passed as an argument.
6+
7+
## Debugging the error
8+
9+
To resolve this error, ensure that your `main.server.ts` file correctly passes a `BootstrapContext` to the `bootstrapApplication` function.
10+
11+
```typescript
12+
import { bootstrapApplication, BootstrapContext } from '@angular/platform-browser';
13+
import { App } from './app/app';
14+
import { config } from './app/app.config.server';
15+
16+
const bootstrap = (context: BootstrapContext) => bootstrapApplication(App, config, context);
17+
export default bootstrap;
18+
```

adev/src/content/reference/errors/overview.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
| `NG0300` | [Selector Collision](errors/NG0300) |
1313
| `NG0301` | [Export Not Found](errors/NG0301) |
1414
| `NG0302` | [Pipe Not Found](errors/NG0302) |
15+
| `NG0401` | [Missing platform](errors/NG0401) |
1516
| `NG0403` | [Bootstrapped NgModule doesn't specify which component to initialize](errors/NG0403) |
1617
| `NG0500` | [Hydration Node Mismatch](errors/NG0500) |
1718
| `NG0501` | [Hydration Missing Siblings](errors/NG0501) |
@@ -30,7 +31,7 @@
3031
| `NG01203` | [Missing value accessor](errors/NG01203) |
3132
| `NG02200` | [Missing Iterable Differ](errors/NG02200) |
3233
| `NG02800` | [JSONP support in HttpClient configuration](errors/NG02800) |
33-
| `NG02802` | [Headers not transferred by HttpTransferCache](errors/NG02802) |
34+
| `NG02802` | [Headers not transferred by HttpTransferCache](errors/NG02802) |
3435
| `NG05000` | [Hydration with unsupported Zone.js instance.](errors/NG05000) |
3536
| `NG05104` | [Root element was not found.](errors/NG05104) |
3637

goldens/public-api/core/errors.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export const enum RuntimeErrorCode {
140140
// (undocumented)
141141
PLATFORM_ALREADY_DESTROYED = 404,
142142
// (undocumented)
143-
PLATFORM_NOT_FOUND = 401,
143+
PLATFORM_NOT_FOUND = -401,
144144
// (undocumented)
145145
PROVIDED_BOTH_ZONE_AND_ZONELESS = 408,
146146
// (undocumented)

packages/core/src/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const enum RuntimeErrorCode {
6666

6767
// Bootstrap Errors
6868
MULTIPLE_PLATFORMS = 400,
69-
PLATFORM_NOT_FOUND = 401,
69+
PLATFORM_NOT_FOUND = -401,
7070
MISSING_REQUIRED_INJECTABLE_IN_BOOTSTRAP = 402,
7171
BOOTSTRAP_COMPONENTS_NOT_FOUND = -403,
7272
PLATFORM_ALREADY_DESTROYED = 404,

0 commit comments

Comments
 (0)