nativescript-schematics icon indicating copy to clipboard operation
nativescript-schematics copied to clipboard

Collection "@nativescript/schematics" cannot be resolved. (when run "ng g c component-name")

Open betosalvador opened this issue 5 years ago • 7 comments

Describe the bug Hi guys!

I removed the old version of nativescript and @nativescript/schematics that was installed and I installed the last nativescript (6.8.0) and last @nativescript/schematics (10.0.1)

I geneted a new project (shared) using schematic, but when I try to generate a new component or module I get the error "An unhandled exception occurred: Collection "@nativescript/schematics" cannot be resolved".

I had to run "npm install -D @nativescript/schematics" to fix the problem.

Is this normal?

To Reproduce npm i -g [email protected] npm i -g @nativescript/[email protected] ng new --collection=@nativescript/schematics test-my-shared-app --shared cd test-my-shared-app
ng g c testpage

(An unhandled exception occurred: Collection "@nativescript/schematics" cannot be resolved.)

Expected behavior Generate a new component called "testpage" without error.

betosalvador avatar Aug 01 '20 00:08 betosalvador

I have the same problem, but not only with component. If try to generate a service, it produce the same error message for me.

qpi avatar Nov 10 '20 20:11 qpi

This error also occurs with the NativeScript 7 and schematics 10.2.0.

Once you generate the project and run ng there, it will use the local node_modules instead of global. You can eliminate this error message by installing the package to your project.

npm install @nativescript/schematics

However, after installing the package, running ng g c new-component again now gives me

Option "entryComponent" is deprecated: Since version 9.0.0 with Ivy, entryComponents is no longer necessary. Cannot read property 'kind' of undefined

steamwings avatar Nov 14 '20 14:11 steamwings

I found the solution here for the last error : https://github.com/NativeScript/NativeScript/issues/8994#issuecomment-719948878 (update typescript to 4.0.3)

Option "entryComponent" is deprecated: Since version 9.0.0 with Ivy, entryComponents is no longer necessary.
Cannot read property 'kind' of undefined

I can now create new component.

rbinsztock avatar Nov 21 '20 18:11 rbinsztock

alguna solucion???

nicoisz avatar Jan 30 '21 19:01 nicoisz

Check if you have node_modules there. If yes, and it shouldn't be there, rm -rf node_modules.

whatwhywhenandwho avatar Feb 13 '21 00:02 whatwhywhenandwho

  1. Uninstall @angular/cli, @schematics/angular and @nativescript/schematics from project dependency
  2. Reinstall them as DEV Dependency
  3. @schematics/angular should be at 9.1.0
  4. After that uninstall and reinstall tslint
  5. Also use --skip-import

image

sudiptosen avatar Mar 02 '21 20:03 sudiptosen

  1. Uninstall @angular/cli, @schematics/angular and @nativescript/schematics from project dependency
  2. Reinstall them as DEV Dependency
  3. @schematics/angular should be at 9.1.0
  4. After that uninstall and reinstall tslint
  5. Also use --skip-import

image

Can you be more specific?

paveldabrowski avatar Mar 04 '21 19:03 paveldabrowski