5

Moments earlier I created project with angular - nativescript. I've used only commands from documentation, after installing I am trying to run this command :

ng generate component home 

I get this error :

An unhandled exception occurred: Cannot find module '@schematics/angular/utility/parse-name' See "C:\Users\andri\AppData\Local\Temp\ng-JFv0M5\angular-errors.log" for further details.

Further details :

[error] Error: Cannot find module '@schematics/angular/utility/parse-name' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15) at Function.Module._load (internal/modules/cjs/loader.js:508:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object. (C:\Users\andri\AppData\Roaming\npm\node_modules@nativescript\schematics\src\generate\component\index.js:6:22) at Module._compile (internal/modules/cjs/loader.js:701:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10) at Module.load (internal/modules/cjs/loader.js:600:32) at tryModuleLoad (internal/modules/cjs/loader.js:539:12) at Function.Module._load (internal/modules/cjs/loader.js:531:3)

How do I fix this ?

My info :

√ Component nativescript has 6.0.3 version and is up to date.
√ Component tns-core-modules has 6.0.7 version and is up to date.
√ Component tns-android has 6.0.2 version and is up to date.
√ Component tns-ios has 6.0.2 version and is up to date.

Angular CLI: 8.3.0
Node: 10.15.3
Angular: 8.2.3
@angular-devkit/architect    0.803.0 (cli-only)
@angular-devkit/core         8.2.2
@angular-devkit/schematics   8.3.0
@ngtools/webpack             8.2.2
@schematics/angular          8.3.0
@schematics/update           0.803.0 (cli-only)
rxjs                         6.5.2
typescript                   3.5.3
webpack                      4.27.1

7 Answers 7

12

I had similar problem with ng g with Nativescript, so maybe it will help somebody

Possible errors:

An unhandled exception occurred: Could not find module "@nativescript/schematics" from
An unhandled exception occurred: Cannot find module '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript'
An unhandled exception occurred: Cannot find module 'tslint'

For tns --version: 6.3.3

Following dependencies are missing: @nativescript/schematics @schematics/angular tslint

To make it working, run:

npm i -D @nativescript/schematics @schematics/angular tslint
Sign up to request clarification or add additional context in comments.

1 Comment

After these codes I got Cannot find module '@schematics/angular/utility/config'
2

This worked for me:

npm i -D @nativescript/schematics

npm i -D @angular/cli

ng g c test

Comments

1

Try This,

npm uninstall -g @angular/cli

then,

npm install -g @angular/cli

Comments

1

I did this:

npm install -g @schematics/angular

and that resolved the issue for me.

Comments

0

You can resolve this issue by executing the following commands:

npm uninstall -g @angular/cli
yarn global add @angular/cli

For any further help follow this link as this seems to be a replica of same issue.

4 Comments

I have it. I installed it before , when I saw this error. Then error changed from Could not resolve schematics/angular to this what I wrote in my question.
I can even find that parse-name module in my node_modules
add a period in front and give it a try. I've updated it
npm ERR! 404 Not Found: @.schematics/angular@latest
0

I fixed this issue by installing in the project the angular CLI

npm install -D @angular/cli

and then running the command using npx

npx ng generate component home

Hope it helps

Comments

0

The following worked for me:

  • install latest version of angular cli using:

     npm install -g @angular/cli"
    
  • delete node_modules and package-lock.json from your project
  • run:

    npm install
    

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.