我是原生脚本开发的新手,我正在尝试使用以下命令创建一个新组件:组件名称
得到的错误是:发生未处理的异常:无法找到模块'@schematics/angular/utility/parse-name'
我已经运行了以下命令:
npm i -D @nativescript/schematics @schematics/angular tslint
即使我安装了@schematics/angular版本9.1.0,我也会得到以下错误:
Could not find an NgModule. Use the skip-import option to skip importing in NgModule
我不想通过跳过导入来创建组件,并希望组件自动添加到模块中。
即使我跳过对模块的导入,我也会在组件的TS类中得到以下错误:
Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.ts(1219)
在tsconfig中设置为true,所以不确定如何修复上述所有问题!
TNS设置正确,显示运行TNS医生后没有问题。
Angular和native - script的最新版本:
Angular CLI: 11.1.1节点:10.23.1操作系统:darwin x64
Angular: 11.0.9
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1101.1 (cli-only)
@angular-devkit/core 10.0.8
@angular-devkit/schematics 11.1.1 (cli-only)
@ngtools/webpack 11.0.7
@schematics/angular 11.1.1 (cli-only)
@schematics/update 0.1101.1 (cli-only)
rxjs 6.6.3
typescript 4.0.5
TNS医生:
No issues were detected.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods are installed.
✔ CocoaPods update is not required.
✔ CocoaPods are configured properly.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✔ Xcode version 12.3.0 satisfies minimum required version 10.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 7.1.2 version and is up to date.
in angular。json删除
"cli": {
"defaultCollection": "@nativescript/schematics",
"analytics": false
},
和ng g c your-component