Collection "@nativescript/schematics" cannot be resolved. (when run "ng g c component-name")
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.
I have the same problem, but not only with component. If try to generate a service, it produce the same error message for me.
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
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.
alguna solucion???
Check if you have node_modules there. If yes, and it shouldn't be there, rm -rf node_modules.
- Uninstall @angular/cli, @schematics/angular and @nativescript/schematics from project dependency
- Reinstall them as DEV Dependency
- @schematics/angular should be at 9.1.0
- After that uninstall and reinstall tslint
- Also use --skip-import

- Uninstall @angular/cli, @schematics/angular and @nativescript/schematics from project dependency
- Reinstall them as DEV Dependency
- @schematics/angular should be at 9.1.0
- After that uninstall and reinstall tslint
- Also use --skip-import
Can you be more specific?