hhww59
hhww59

Reputation: 61

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

The error I am getting is: An unhandled exception occurred: Cannot find module '@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:

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:

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!

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

Angular and nativescript versions are latest:

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 Doctor:

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.

Upvotes: 0

Views: 580

Answers (1)

Isaac Barrera
Isaac Barrera

Reputation: 329

in angular.json delete

"cli": {​​

"defaultCollection": "@nativescript/schematics",

"analytics": false

}​​,

and ng g c your-component

Upvotes: 1

Related Questions