如何创建独立项目

问题描述 投票:0回答:1

我以前从未使用过独立版。现在我想尝试一下。

我使用以下命令创建了一个新项目:

lang-bash ng new client --style=scss --standalone 

当我尝试运行该项目时,我得到一个带有错误的空白页面

Uncaught SyntaxError: Unexpected token '{'

我没有对项目进行任何更改。

我正在使用:

"@angular/cli": "^16.2.15",
"typescript": "^5.1.3"

为什么当“hello world”页面启动时就给出错误?

main.ts

import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';

bootstrapApplication(AppComponent, appConfig)
  .catch((err) => console.error(err));

app.config.ts

import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';

import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
  providers: [provideRouter(routes)]
};

angular
1个回答
0
投票

你检查一下你的node版本吗,我也遇到了同样的问题,升级node版本后,它运行得很好。

© www.soinside.com 2019 - 2024. All rights reserved.