Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create Angular web app #308

Open
nx-irvin opened this issue May 16, 2022 · 11 comments
Open

Unable to create Angular web app #308

nx-irvin opened this issue May 16, 2022 · 11 comments

Comments

@nx-irvin
Copy link

I'm trying to create a web a app following the getting started steps. I managed to create an Ionic + Angular App, but when i try the same steps with web + angular it doesn't work. I get the following messages:

Error: Could not find an NgModule. Use the skip-import option to skip importing in NgModule.
at findModule (C:\na\dvlp\wks2021\nexus-monorepo\node_modules@schematics\angular\utility\find-module.js:81:11)
at findModuleFromOptions (C:\na\dvlp\wks2021\nexus-monorepo\node_modules@schematics\angular\utility\find-module.js:26:38)
at C:\na\dvlp\wks2021\nexus-monorepo\node_modules@schematics\angular\component\index.js:105:66
Error: Could not find an NgModule. Use the skip-import option to skip importing in NgModule.
at findModule (C:\na\dvlp\wks2021\nexus-monorepo\node_modules@schematics\angular\utility\find-module.js:81:11)
at findModuleFromOptions (C:\na\dvlp\wks2021\nexus-monorepo\node_modules@schematics\angular\utility\find-module.js:26:38)

Steps:

nx generate app
√ What name would you like for this app? · my-app-web
√ What type of app would like to create? · web
√ In which directory should the app be generated? 'apps'
√ Would you like to configure routing for this app? (Y/n) · true
√ Which frontend framework should it use? · angular
√ Use xplat supporting architecture? (Y/n) · true

@NathanWalker
Copy link
Member

@nx-irvin thanks for the report. I just tried this here:

npx create-nx-workspace@latest

> sample
// let dependencies install and finish initial setup

> cd sample
> npm install @nstudio/xplat -D
> npx nx g app
> myapp
> web
> npx nx run web-myapp:serve
// works

You may try leaving web out of the app name since xplat adds the platform naming conventions itself - that may be interfering with the generators.

@nx-irvin
Copy link
Author

Hi! Thanx for the quick response. I tried without the word web and I get the same error.

@NathanWalker
Copy link
Member

When you can run “ng —version”

Sounds like there could be global angular versions installed which may be having an effect?

@nx-irvin
Copy link
Author

Ok, this is what i got:

Angular CLI: 13.2.6
Node: 14.18.1
Package Manager: npm 8.5.4
OS: win32 x64

Angular: undefined
...

Package Version

@angular-devkit/architect 0.1302.6 (cli-only)
@angular-devkit/core 13.3.5
@angular-devkit/schematics 13.3.5
@schematics/angular 13.3.5
typescript 4.6.4

@NathanWalker
Copy link
Member

Thanks could be your node version. Would generally recommend 15+ but I would switch to using node 16, 17 or 18.
I’m using node 18 with npm 8.10.0 myself (latest of everything).

@nx-irvin
Copy link
Author

I will update to version 18 and 8.10.0 and let you know.

@nx-irvin
Copy link
Author

I´m still getting the same error. I tried in a different PC installing all from scratch and the same result.

@NathanWalker
Copy link
Member

I think it may be due to a Nx preset you may be using, when doing:
npx create-nx-workspace@latest
Then naming the workspace, after that it asks what preset you’d like to use - are you choosing Angular? If so that is likely the issue. You would want to choose empty or no preset - I believe they call it simply “apps” the first one in list.

@NathanWalker
Copy link
Member

@nx-irvin lemme know if the preset was it when you get a chance; pretty curious here.

@nx-irvin
Copy link
Author

Apparently it was due to the Nx 'apps' preset.
I was finally able to go around this issue using the 'angular' preset.

@NathanWalker
Copy link
Member

Interesting I see exact opposite of that here (wonder if Windows has some affect here) - we’ll leave this open until more finite conclusions can be drawn. Thanks for mentioning this and that there is a solution for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants