Nativescript + Angular项目错误:发生未处理的异常:找不到模块'@ schematics/angular/utility/parse-name' [英] Nativescript + Angular project error: An unhandled exception occurred: Cannot find module '@schematics/angular/utility/parse-name'

查看:108
本文介绍了Nativescript + Angular项目错误:发生未处理的异常:找不到模块'@ schematics/angular/utility/parse-name'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Nativescript开发的新手,我正在尝试使用以下命令创建一个新组件:ng g c组件名称

I am new to nativescript development and I am trying to create a new component using the following command: ng g c component-name

我得到的错误是:发生未处理的异常:找不到模块'@ schematics/angular/utility/parse-name'

The error I am getting is: An unhandled exception occurred: Cannot find module '@schematics/angular/utility/parse-name'

我运行了以下内容:

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

即使我安装了@ schematics/angular版本9.1.0,也会出现以下错误:

Even if I install @schematics/angular version 9.1.0, I get the following error:

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.

即使我确实跳过了导入模块的操作,我也会在组件的TS类中得到以下错误:

Even if I do skip the import to the module, I then get the following error to the TS class of the component:

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,因此不确定如何解决以上所有问题!

This is set to true in the tsconfig, so not sure how to fix all the above!

TNS设置正确,运行tns doctor后显示,没有问题.

TNS is setup correctly, shown after running tns doctor with no issues.

Angular和nativescript版本是最新的:

Angular and nativescript versions are latest:

Angular CLI:11.1.1节点:10.23.1操作系统:darwin x64

Angular CLI: 11.1.1 Node: 10.23.1 OS: 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.

推荐答案

在angular.json中删除

in angular.json delete

"cli": {​​

"defaultCollection": "@nativescript/schematics",

"analytics": false

}​​,

您的组件

这篇关于Nativescript + Angular项目错误:发生未处理的异常:找不到模块'@ schematics/angular/utility/parse-name'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆