Closed cipchk closed 4 months ago
运行环境: Node:v20.10.0 npm:10.2.4 yarn:1.22.21
使用如下命令进行angular项目初始化后,报错:
ng new my-project --style less --routing --package-manager yarn
cd my-project
# 以上命令执行正常
ng add ng-alain
# 以上命令执行报错,报错信息如下
i Using package manager: yarn
√ Found compatible package version: ng-alain@17.0.0.
√ Package information loaded.
The package ng-alain@17.0.0 will be installed and executed.
Would you like to proceed? Yes
√ Packages successfully installed.
Cannot find module '@angular/cdk/schematics'
Require stack:
- D:\my-project\node_modules\ng-alain\utils\standalone.js
- D:\my-project\node_modules\ng-alain\utils\alain.js
- D:\my-project\node_modules\ng-alain\utils\ast.js
- D:\my-project\node_modules\ng-alain\utils\index.js
- D:\my-project\node_modules\ng-alain\ng-add\index.js
- D:\my-project\node_modules\@angular-devkit\schematics\tools\export-ref.js
- D:\my-project\node_modules\@angular-devkit\schematics\tools\index.js
- D:\my-project\node_modules\@angular\cli\src\commands\add\cli.js
- D:\my-project\node_modules\@angular\cli\src\commands\command-config.js
- D:\my-project\node_modules\@angular\cli\src\command-builder\command-runner.js
- D:\my-project\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\marbl\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
# 需要手动执行以下命令
yarn add @angular/cdk
# 再次执行以下命令,报新的错误
ng add ng-alain
Sorry, currently only supports 16, 18 major version number of node (Got v20.10.0), pls refer to https://angular.io/guide/versions
什么时候能执行NodeJS的20版本?
@marbleqi 我会修复 ,暂时先用 nvm 切换到 18.13
的版本
Cannot find module '@angular/cdk/schematics'
这个错误也一起修复了吧。
ng add ng-alain
# 以上命令执行报错,报错信息如下
i Using package manager: yarn
√ Found compatible package version: ng-alain@17.0.0.
√ Package information loaded.
The package ng-alain@17.0.0 will be installed and executed.
Would you like to proceed? Yes
√ Packages successfully installed.
Cannot find module '@angular/cdk/schematics'
Require stack:
- D:\my-project\node_modules\ng-alain\utils\standalone.js
- D:\my-project\node_modules\ng-alain\utils\alain.js
- D:\my-project\node_modules\ng-alain\utils\ast.js
- D:\my-project\node_modules\ng-alain\utils\index.js
- D:\my-project\node_modules\ng-alain\ng-add\index.js
- D:\my-project\node_modules\@angular-devkit\schematics\tools\export-ref.js
- D:\my-project\node_modules\@angular-devkit\schematics\tools\index.js
- D:\my-project\node_modules\@angular\cli\src\commands\add\cli.js
- D:\my-project\node_modules\@angular\cli\src\commands\command-config.js
- D:\my-project\node_modules\@angular\cli\src\command-builder\command-runner.js
- D:\my-project\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\marbl\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
Cannot find module '@angular/cdk/schematics'
这个错误也一起修复了吧。
ng add ng-alain # 以上命令执行报错,报错信息如下 i Using package manager: yarn √ Found compatible package version: ng-alain@17.0.0. √ Package information loaded. The package ng-alain@17.0.0 will be installed and executed. Would you like to proceed? Yes √ Packages successfully installed. Cannot find module '@angular/cdk/schematics' Require stack: - D:\my-project\node_modules\ng-alain\utils\standalone.js - D:\my-project\node_modules\ng-alain\utils\alain.js - D:\my-project\node_modules\ng-alain\utils\ast.js - D:\my-project\node_modules\ng-alain\utils\index.js - D:\my-project\node_modules\ng-alain\ng-add\index.js - D:\my-project\node_modules\@angular-devkit\schematics\tools\export-ref.js - D:\my-project\node_modules\@angular-devkit\schematics\tools\index.js - D:\my-project\node_modules\@angular\cli\src\commands\add\cli.js - D:\my-project\node_modules\@angular\cli\src\commands\command-config.js - D:\my-project\node_modules\@angular\cli\src\command-builder\command-runner.js - D:\my-project\node_modules\@angular\cli\lib\cli\index.js - C:\Users\marbl\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
需要追加这个命令 ng new my-project --style less --routing --standalone
升级17后出现1个现象: 开发模式下,修改代码并保存,控制台输出: 然而浏览器没有刷新,即便手动刷新也无效,修改的变更没有生效
升级到17后,ST表格通过url获取数据的方式出了问题,控制台里看有调用url并且有返回值,但是页面上数据没有渲染出来,依然是暂无数据
升级到17后,ST表格通过url获取数据的方式出了问题,控制台里看有调用url并且有返回值,但是页面上数据没有渲染出来,依然是暂无数据
能否提供一下复现 ?
升级到17后,ST表格通过url获取数据的方式出了问题,控制台里看有调用url并且有返回值,但是页面上数据没有渲染出来,依然是暂无数据
能否提供一下复现 ?
在ModalHelper中使用st组件,会出现 NullInjectorError: No provider for _NzContextMenuService,导致弹出框页面无法加载
update error
English Version
Before upgrade
Node.js
>=18.13.0
.package-lock.json
oryarn.lock
file.1.Upgrade dependencies
ng update @angular/core@17 @angular/cli@17 @angular-eslint/schematics@17 ng-zorro-antd@17 ng-alain@17
.ng update @angular/cdk@17
, if you have used@angular/cdk
.Optional
The optional part of the work is centered around Standalone. Currently, NG-ALAIN will reserve some DEMO pages using the NgModule writing method. #2442 contains all changes in this PR.
Upgrade to Standalone
bootstrapApplication
instead ofplatformBrowserDynamic
app.config.ts
instead ofglobal-config.module.ts
,app.module.ts
The
layout
,dashboard
,passport
have been rewritten using standalone and can be modified according to #2442 changes.DI configuration
Module. forRoot
. Of course, for compatibility, theNgModule
writing method is still retained.provide*
, seeapp.config.ts
for more detailsprovide
writing method, you need to transition throughimportProvidersFrom
HTTP interceptor
HttpInterceptorFn
writing method (seeprovideHttpClient
for details)withInterceptorsFromDi()
will be imported by default to be compatible with theHTTP_INTERCEPTORS
writing method, but it is recommended to upgrade to the new writing method as much as possible, please refer to #2442About
@delon/form
中文版
开始之前
Node.js
>=18.13.0
package-lock.json
或yarn.lock
文件升级步骤
升级相关依赖
ng update @angular/core@17 @angular/cli@17 @angular-eslint/schematics@17 ng-zorro-antd@17 ng-alain@17
。@angular/cdk
请执行ng update @angular/cdk@17
可选部分
可选部分的主要工作都是围绕 Standalone 展开,目前 NG-ALAIN 会保留部分DEMO页使用 NgModule 写法。#2442 包含着这部分变动的所有内容。
升级为 Standalone
bootstrapApplication
替代platformBrowserDynamic
app.config.ts
替代global-config.module.ts
,app.module.ts
其中
layout
,dashboard
,passport
目录采用 standalone 写法,可根据 #2442 变动自行修改。DI配置
Module. forRoot
之类的 DI 配置模式,当然为了兼容,依然保留NgModule
写法provide*
来维护,更多细节见app.config.ts
provide
写法时,只需要借助importProvidersFrom
过渡HTTP拦截器
HttpInterceptorFn
写法(细节见provideHttpClient
)withInterceptorsFromDi()
用于兼容HTTP_INTERCEPTORS
写法,但建议尽可能升级新的写法,可参考 #2442关于
@delon/form