-
Notifications
You must be signed in to change notification settings - Fork 12k
"ng generate module/component" doesn't work as expected #5127
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
Comments
Hi @bboehm86 , I tried to repo your issue and I can confirm it happens on projects running cli RC0, I first tested on Beta.29 this issue was not present. For your last 2 points, it sounds like it's more of a new feature request to support adding components to specific modules. The thing is that the cli is in RC now which means no new features will be added until 2.0 I'll have a look through the recent PR on module creation to see what can be causing the routing issue. |
Hey @RicardoVaranda , thanks for having a look. 👍 I'm not entirely sure that it is a new feature since I was under the impression that the new components will/should be added to the nearest module. |
I'm having this issue, too. All new components are being added not to the nearest module, but to the root app.module. This is not a new feature....but it does appear to be broken. I can confirm that @bboehm86 suggestion of After generating a new module
|
@Brocco can you weigh in? |
Partially dupe of #4614 |
Same here: $ ng --version
@angular/cli: 1.0.0-rc.1
node: 6.10.0
os: win32 x64
@angular/common: 2.4.9
@angular/compiler: 2.4.9
@angular/core: 2.4.9
@angular/forms: 2.4.9
@angular/http: 2.4.9
@angular/platform-browser: 2.4.9
@angular/platform-browser-dynamic: 2.4.9
@angular/router: 3.4.9
@angular/cli: 1.0.0-rc.1
@angular/compiler-cli: 2.4.9 Steps: $ ng g module back --routing
installing module
create src\app\back\back-routing.module.ts
create src\app\back\back.module.ts
$ ng g component back\home --module back
installing component
create src\app\back\home\home.component.sass
create src\app\back\home\home.component.html
create src\app\back\home\home.component.spec.ts
create src\app\back\home\home.component.ts
EISDIR: illegal operation on a directory, read
Error: EISDIR: illegal operation on a directory, read
at Error (native)
at Object.fs.readSync (fs.js:731:19)
at tryReadSync (fs.js:486:20)
at Object.fs.readFileSync (fs.js:534:19)
at Class.afterInstall (C:\Users\alvaro\Desktop\testing\node_modules\@angular\cli\blueprints\component\index.js:190:34)
at tryCatch (C:\Users\alvaro\Desktop\testing\node_modules\rsvp\dist\rsvp.js:538:12)
at invokeCallback (C:\Users\alvaro\Desktop\testing\node_modules\rsvp\dist\rsvp.js:553:13)
at publish (C:\Users\alvaro\Desktop\testing\node_modules\rsvp\dist\rsvp.js:521:7)
at flush (C:\Users\alvaro\Desktop\testing\node_modules\rsvp\dist\rsvp.js:2373:5)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9) The result is the expected unless the new component is not included in the module structure. In other words, the module does not declare the new component. |
@bboehm86, The issue is that by not specifying @markgoho and @AlvaroOrduna, you will need to be more specific on the file you wish to use for your module. @markgoho: That said, I'll look into creating a PR for both of these issues. I'll let the CLI team determine what the correct functionality is. Side note: I incorrectly thought my other PR, #5218, fixed this issue. It does not. |
Closing this one in favor of tracking it via #4614 |
…ar#5218) * fix(@angular/cli): fix issue with console prompt bailing early fixes angular#4614 * fix(@angular/cli): fix declarable types not finding closest module fixes angular#5127
I have same issue , when i try to generate the component, the cmd didn't create the files and the folder, inside the project. ERROR in C:/wamp64/www/p-page/src/app/app.module.ts (5,30): Cannot find module './app/cp1/cp1.component'. ERROR in ./app.module.ts ERROR in C:/wamp64/www/p-page/src/app/app.module.ts (5,30): Cannot find module './src/app/cp1/cp1.component'. ERROR in C:/wamp64/www/p-page/src/app/app.module.ts (5,30): Cannot find module './src/app/cp1/cp1.component'. ERROR in ./app.module.ts @angular/cli: 1.2.7 C:\wamp64\www\p-page\src\app> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OS?
Versions.
Repro steps.
run
ng g m my-module
- [ will work as expected ]decide that you want a module and routes, so run
ng g m my-module --routing
get asked if you want to override the old module, hit
y
get sad because the routing file was not created 😢
decide that you want to add a component matching the module name, so run
ng g c my-module
get sad again because the new component got not added to your new
my-module.module.ts
but to yourapp.module.ts
😢be happy again because the Angular CLI is such a timesaver for most parts 😄👍
The log given by the failure.
Mention any other details that might be useful.
Thanks to the team for all the effort ❤️
The text was updated successfully, but these errors were encountered: