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

Angular CLI generate results in 'Project is not configured for NativeScript, while --web is set to false'

Open martijnvanschie opened this issue 5 years ago • 23 comments

Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 7.0.0
  • Cross-platform modules: None
  • Android Runtime: None
  • iOS Runtime: None
  • Plugin(s): None
  • NativeScript-Angular: ~10.0.0
  • Angular: ~10.0.0

Describe the bug When generating a angular building block using the Angular CLI i get a message: Project is not configured for NativeScript, while --web is set to false

To Reproduce Create a new app from the empty 7.0.0 template tns create test-app --template @nativescript/template-blank-ng

Install the Angular CLI and Schematics as noted on the site Angular CLI npm i --save-dev @angular/cli npm i --save-dev @nativescript/schematics

Generate a module using the Angular CLI ng generate module test

Expected behavior A module names test.module.ts should be create in the folder.

Sample project No sample project.

Additional context This is done using a clean project created using the empty template and no additional work was done prio to this issue.

martijnvanschie avatar Sep 02 '20 12:09 martijnvanschie

Same issue here!!

is it the folder schema that has be changed?

Abstrucked avatar Sep 07 '20 11:09 Abstrucked

Did you find a fix?

JasonTomahawk avatar Sep 07 '20 16:09 JasonTomahawk

Same issue here ++

boerkey avatar Sep 08 '20 11:09 boerkey

No resolution yet unfortunately. Already updated all packages but still the error.

martijnvanschie avatar Sep 08 '20 12:09 martijnvanschie

I took a sledge hammer to it. Backed up src directory, uninstalled angular cli, native script and node.js, reinstalled node.js, native script and angular cli, created a new nativescript angular project using the tns create command and copied in my src directory. I'm able to lauch the app but the tns g c command does not work, but i'll get over that.

JasonTomahawk avatar Sep 08 '20 14:09 JasonTomahawk

Hi @JasonTomahawk ... then you actually still have the issue that is reported here :). The fact that ng generate <buildingblock> is not working right?

martijnvanschie avatar Sep 08 '20 15:09 martijnvanschie

Hi @martijnvanschie here's an alternative extension https://marketplace.visualstudio.com/items?itemName=joshdsommer.vscode-add-angular-native-files. Would still like to fix the underlying issue

JasonTomahawk avatar Sep 09 '20 11:09 JasonTomahawk

Hi... same error with me... this is because on the new Nativescript CLI v7... it no longer uses "nsconfig.json", so that's why we get this message:

nsconfig.json not found. Assuming this is a {N} only project Project is not configured for NativeScript, while --web is set to false

Nativescript Team please fix the @nativescript/schematics to be able to use the new config file "nativescript.config.js"

Ziggymusician avatar Sep 09 '20 14:09 Ziggymusician

@JasonTomahawk thank... installed it. Its usefull but still limited. But is speeds up the process of manually adding the files.

martijnvanschie avatar Sep 09 '20 18:09 martijnvanschie

Same Issue here ++ It takes a lot of time when I have to create files manually for code sharing project ( web and mobile ).

SKTAR avatar Sep 10 '20 14:09 SKTAR

It can be fixed by adding "nativescript" key in your package.json

package.json:

{
  ...
  "nativescript": {
    "id": "org.organization.app"
  },
  ...
}

Please, keep in mind that in previous versions "nativescript" key has more information than that, so you might need to add more info in order to keep other features working - what I am addressing here is just ng g c component command.

Btw - I started using Nativescript to build a new app just a few days ago and already have run into numerous problems with. In the beginning, I was VERY excited but it seems to almost be an abandoned project without anyone taking proper care of it, so just a word of advice from me - if you are here and try to use it in something else than a small project without a clear deadline I would strongly reconsider. Versioning is all over the place and you need to fix and patch things until it works, there is no clear instruction about what is the current way of doing things - some features are just broken and not working at all. I'm sticking with it just for the sake of my small hobby project.

alan-mroczek avatar Sep 11 '20 19:09 alan-mroczek

I kinda agree on your statement. Been running into a lot of small issues. Sometime due to not understanding the Framework but also sometime because of issues not being described, addressed or even known. It's an open project so i can't complain to much as it is being maintained by others.

Been thinking of digging into the plain XML version as i still feel that the mutitarget part is really strong.

Will try your fix soon and let you know :)

martijnvanschie avatar Sep 12 '20 07:09 martijnvanschie

I've installed the current latest @nativescript/[email protected] now the ng commands work. Thanks NativeScript team.

Ziggymusician avatar Sep 17 '20 11:09 Ziggymusician

Of course i wanted to try this ASAP but now i get the following error message :(

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

Glad it worked for you though @Ziggymusician :)

martijnvanschie avatar Sep 17 '20 13:09 martijnvanschie

entryComponents and ANALYZE_FOR_ENTRY_COMPONENTS no longer required... But not sure why you got an error because it's still in deprecation, not yet removed. But try removing entryComponents or try to find out what is accessing 'kind' and fix that.

https://angular.io/guide/deprecations

Ziggymusician avatar Sep 17 '20 13:09 Ziggymusician

Can only find reference to entryComponents in vendor.js. Dunno what's wrong. Will check later.

oh the agony

martijnvanschie avatar Sep 17 '20 14:09 martijnvanschie

Okay cool... good luck

Ziggymusician avatar Sep 17 '20 14:09 Ziggymusician

It can be fixed by adding "nativescript" key in your package.json

package.json:

{
  ...
  "nativescript": {
    "id": "org.organization.app"
  },
  ...
}

This worked for me.

patricknee avatar Sep 26 '20 10:09 patricknee

Please anyone with widely used solution, I have install angular-cli, schematics both global and dev-dependencies locally on the app but still getting this

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

kielsoft avatar Oct 01 '20 15:10 kielsoft

Please anyone with widely used solution, I have install angular-cli, schematics both global and dev-dependencies locally on the app but still getting this

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

I have the exact same issue, any solution?

MegganKNaude avatar Oct 04 '20 17:10 MegganKNaude

@martijnvanschie did you happen to find a solution to your secondary issue?

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

Solution that worked for me:

Updating the typescript devDependency from 3.9.0 to 4.0.3 and running ng g c [directory-name] --skip-import

MegganKNaude avatar Oct 04 '20 17:10 MegganKNaude

@MegganKNaude nope, not seen this working. Just checked again on a project where i actually updated all packages to the latest but still the entryComponent error.

martijnvanschie avatar Oct 05 '20 09:10 martijnvanschie

@MegganKNaude Thanks, it worked, still need to:

Install:

  • @angular/cli
  • @nativescript/schematics
  • @schematics/angular
  • typescript: 4.0.3

Add

  "nativescript": {
    "id": "com.organizaton.app"
  }

Example

  "devDependencies": {
    "@angular/cli": "^10.1.7",
    "@angular/compiler-cli": "~10.1.0",
    "@nativescript/schematics": "^10.1.0",
    "@nativescript/types": "~7.0.0",
    "@nativescript/webpack": "~3.0.0",
    "@ngtools/webpack": "~10.1.0",
    "@schematics/angular": "^10.1.7",
    "tslint": "^6.1.3",
    "typescript": "^4.0.3"
  },
  "nativescript": {
    "id": "com.organizaton.app"
  }

Than run ng g c <Component name> --skip-import.

belachkar avatar Oct 22 '20 00:10 belachkar