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

Creating a module deeper than src/app throws Invalid path

Open SebastianSchenk opened this issue 10 years ago • 7 comments

Please provide us with the following information:

OS?

Mac OSX El Capitan 10.11.4

Versions.

angular-cli: 1.0.0-beta.21 node: 6.7.0 os: darwin x64

Repro steps.

  • Create new project with ng new my-app
  • Create a new folder inside src/app (e.g. src/app/modules)
  • Go to new folder (cd src/app/modules)
  • Create new module (ng g module core)

The log given by the failure.

Invalid path: "/src/app/modules/modules"" is not a valid path.

Mention any other details that might be useful.

To summarise this issue. While creating a new module the cli tries to go into the same folder again, if the module is created deeper than /src/app. Creating an module inside /src/app works as expected.


Thanks! We'll be in touch soon.

SebastianSchenk avatar Nov 23 '16 18:11 SebastianSchenk

I get this too, even with v 22-1

elvisbegovic avatar Dec 16 '16 10:12 elvisbegovic

I got this 22-1 today as well, same conditions (except macOS Sierra 10.12.2):

  • Created Dashboard module: ng g module dashboard --routing true
  • Changed directory into dashboard: cd dashboard
  • Attempted to create nested module: ng g module ./my-projects --routing true

I received: Invalid path: ".....app/dashboard/dashboard"" is not a valid path.

panicst8 avatar Dec 18 '16 20:12 panicst8

I have not been able to reproduce this issue. Can someone who was experiencing this please retry with the latest version of the CLI?

Brocco avatar Dec 30 '16 04:12 Brocco

@Brocco just tested with .beta-24. ng g module module-name doesn't throw this error anymore. Though, using ng g module module-name --routing does throw the error. This means the error occurs during component creation I guess.

SebastianSchenk avatar Dec 30 '16 14:12 SebastianSchenk

I had the same issue on beta22-1 so I updated cli to 24. Now, the error's gone and the difference from the previous is that ng g module "name" command only generates module. Can you please update Readme on generating module with added options? It confuses the old users when generating the modules.

Update: As @SebastianSchenk mentioned, --routing flag also throws error for me. Even in beta22-1, the error occurred on component creation. The error says /src/app/dashboard/dashboard is not a valid path but I'm trying to generate in /src/app/dashboard.

thisisgit avatar Jan 06 '17 02:01 thisisgit

The current behavior for generating modules is to only generate a component when the --routing argument is used. That's why you only get the module.

Added in https://github.com/angular/angular-cli/pull/3389

I'm working on the issue with component, not changing the routing behavior though.

Meligy avatar Jan 09 '17 09:01 Meligy

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.