Skip to content

Generating component for module fails #5614

Closed
@NCC1701M

Description

@NCC1701M

Bug Report or Feature Request (mark with an x)

- [x] bug report
- [ ] feature request

Versions.

@angular/cli: 1.0.0
node: 6.10.0
os: win32 x64
@angular/common: 4.0.0
@angular/compiler: 4.0.0
@angular/core: 4.0.0
@angular/forms: 4.0.0
@angular/http: 4.0.0
@angular/platform-browser: 4.0.0
@angular/platform-browser-dynamic: 4.0.0
@angular/router: 4.0.0
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.0

Repro steps.

Create a new project and change into dir.
ng new MyNgProject

Add a new module

>ng g module admin --routing
installing module
  create src\app\admin\admin-routing.module.ts
  create src\app\admin\admin.module.ts

Try to add component to module
ng g component my-admin --module admin

The log given by the failure.

installing component
  create src\app\my-admin\my-admin.component.scss
  create src\app\my-admin\my-admin.component.html
  create src\app\my-admin\my-admin.component.spec.ts
  create src\app\my-admin\my-admin.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:\Entwicklung\Visual Studio Code\test\MyNgProject\node_modules\@angular\cli\blueprints\component\index.js:209:34)
    at tryCatch (C:\Entwicklung\Visual Studio Code\test\MyNgProject\node_modules\rsvp\dist\rsvp.js:539:12)
    at invokeCallback (C:\Entwicklung\Visual Studio Code\test\MyNgProject\node_modules\rsvp\dist\rsvp.js:554:13)
    at publish (C:\Entwicklung\Visual Studio Code\test\MyNgProject\node_modules\rsvp\dist\rsvp.js:522:7)
    at flush (C:\Entwicklung\Visual Studio Code\test\MyNgProject\node_modules\rsvp\dist\rsvp.js:2414:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)

Desired functionality.

  1. I set the module with the --module flag. Therefore it should create the component in the module directory not in the app directory create src\app\my-admin\my-admin.component.scss
  2. The error happens because it tries to do file i/o on a directory. You can see it when you dry run it. See below

Mention any other details that might be useful.

> ng g component my-admin --module admin --dry-run
installing component
You specified the dry-run flag, so no changes will be written.
  create src\app\my-admin\my-admin.component.scss
  create src\app\my-admin\my-admin.component.html
  create src\app\my-admin\my-admin.component.spec.ts
  create src\app\my-admin\my-admin.component.ts
  update src\app\admin <-- Error happens here, admin is the module folder not the file

Metadata

Metadata

Assignees

No one assigned

    Labels

    P5The team acknowledges the request but does not plan to address it, it remains open for discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions