简体   繁体   English

Nativescript + Angular 项目错误:发生未处理的异常:找不到模块“@schematics/angular/utility/parse-name”

[英]Nativescript + Angular project error: An unhandled exception occurred: Cannot find module '@schematics/angular/utility/parse-name'

I am new to nativescript development and I am trying to create a new component using the following command: ng g c component-name我是 nativescript 开发的新手,我正在尝试使用以下命令创建一个新组件:ng g c component-name

The error I am getting is: An unhandled exception occurred: Cannot find module '@schematics/angular/utility/parse-name'我得到的错误是:发生未处理的异常:找不到模块“@schematics/angular/utility/parse-name”

I have run the following:我运行了以下命令:

npm i -D @nativescript/schematics @schematics/angular tslint

Even if I install @schematics/angular version 9.1.0, I get the following error:即使我安装@schematics/angular 版本 9.1.0,我也会收到以下错误:

Could not find an NgModule. Use the skip-import option to skip importing in NgModule

I do not want to create components by skipping the import and would like the components automatically added to the modules.我不想通过跳过导入来创建组件,而是希望组件自动添加到模块中。

Even if I do skip the import to the module, I then get the following error to the TS class of the component:即使我确实跳过了对模块的导入,我也会在组件的 TS class 中收到以下错误:

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)

This is set to true in the tsconfig, so not sure how to fix all the above!这在 tsconfig 中设置为 true,所以不确定如何解决以上所有问题!

TNS is setup correctly, shown after running tns doctor with no issues. TNS 设置正确,在运行 tns doctor 没有问题后显示。

Angular and nativescript versions are latest: Angular 和 nativescript 版本是最新的:

Angular CLI: 11.1.1 Node: 10.23.1 OS: darwin x64 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 Doctor: 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 delete在 angular.json 中删除

"cli": {​​

"defaultCollection": "@nativescript/schematics",

"analytics": false

}​​,

and ng g c your-componentng g c your-component

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 发生未处理的异常:找不到模块'@schemics/angular/utility/project' - An unhandled exception occurred: Cannot find module '@schematics/angular/utility/project' Angular PWA:发生未处理的异常:找不到模块'@schematics/angular/utility' - Angular PWA: An unhandled exception occurred: Cannot find module '@schematics/angular/utility' 找不到模块'@schemics/angular/utility/project' - Cannot find module '@schematics/angular/utility/project' “找不到模块'@schematics/angular/utility/config' - "Cannot find module '@schematics/angular/utility/config' Angular 安装 ng-bootstrap:找不到模块 '@schematics/angular/utility/project' - Angular Install ng-bootstrap: Cannot find module '@schematics/angular/utility/project' 找不到模块“@schematics/angular/utility/project”的声明文件 - Could not find a declaration file for module '@schematics/angular/utility/project' angular:发生未处理的异常:找不到模块“webpack”? - angular: An unhandled exception occurred: Cannot find module 'webpack'? Angular:发生未处理的异常:找不到模块“webpack/lib/ParserHelpers” - Angular : An unhandled exception occurred: Cannot find module 'webpack/lib/ParserHelpers' Jest Angular 测试给出业力错误`发生未处理的异常:找不到模块'业力'` - Jest Angular testing gives karma error `An unhandled exception occurred: Cannot find module 'karma'` 错误:找不到模块“@angular-devkit/schematics”和找不到模块“@angular-devkit/schematics” - Error: Cannot find module '@angular-devkit/schematics' and Cannot find module '@angular-devkit/schematics'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM