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

--source-dir not working as expected when creating a new project

Open harilal opened this issue 9 years ago • 6 comments

Bug Report or Feature Request (mark with an x)

When a new project is created using --source-dir it creates both src folder and the custom folder. The tsconfig files located inside src folder. But in angular-cli.json it's pointed to src.

Versions.

Angular CLI: 1.5.0 Node: 8.6.0 OS: win32 x64 Angular: ...

Repro steps.

ng new testdir1 --skip-install --source-dir client

Will create both src and client folder.

The log given by the failure.

Desired functionality.

Mention any other details that might be useful.

harilal avatar Nov 13 '17 05:11 harilal

I have this problem, too (Windows 10, 64 bit, NodeJS 6.10.0, Angular 5, Angular CLI 1.5.0 / 1.5.2). When I try to generate a component CLI trys to use a wrong directory (src/client/src/client instead of src/client).

ng g c foobar --skip-import -d
create src/client/src/client/app/foobar/foobar.component.html (25 bytes)
create src/client/src/client/app/foobar/foobar.component.spec.ts (628 bytes)
create src/client/src/client/app/foobar/foobar.component.ts (269 bytes)
create src/client/src/client/app/foobar/foobar.component.css (0 bytes)

In my project I have the directories src/api and src/client (client contains tsconfig.app.json, main.ts etc) and with Angular CLI 1.4.0 and Angular 4 everything was fine, but since the upgrade I can't use the generate commands.

esagawe avatar Nov 17 '17 15:11 esagawe

I have the same problem as @esagawe on Windows 10 64bit, Node 9.2.0, Angular 5.0.0, Angular CLI 1.5.5.

I am building an Electron application with Angular. I had some trouble creating the application properly, but managed to get it to function properly after reading the doc : I have put the Angular app in src/renderer/application. I defined it properly inside the 'apps' array in the .angular-cli.json (the root being defined as src/renderer/application). An ng build or serve works as expected, but when using the generate command, the cli generates the new module or component (or whatever else) inside src/renderer/application/src/renderer/application/app.

I generated the new module first. If I move it manually and try to generate a component for that module, the CLI cannot find the module (Error: Specified module does not exist). Then I left the module as is, and generated the component properly, but in the wrong folder (src/renderer/application/src/renderer/application/app/module). Additionnally, the CLI generated an empty folder with the module name at the correct location.

> ng g m shared
  create src/renderer/application/src/renderer/application/app/shared/shared.module.ts (190 bytes)

Move the folder manually to src/renderer/application/app/ then :

> ng g c shared/window -m shared/shared.module.ts
Error: Specified module does not exist
Specified module does not exist

Delete everything then :

> ng g m shared
  create src/renderer/application/src/renderer/application/app/shared/shared.module.ts (190 bytes)
> ng g c shared/window -m shared/shared.module.ts
  create src/renderer/application/src/renderer/application/app/shared/window/window.component.html (25 bytes)
  create src/renderer/application/src/renderer/application/app/shared/window/window.component.spec.ts (628 bytes)
  create src/renderer/application/src/renderer/application/app/shared/window/window.component.ts (269 bytes)
  create src/renderer/application/src/renderer/application/app/shared/window/window.component.scss (0 bytes)
  update src/renderer/application/src/renderer/application/app/shared/shared.module.ts (266 bytes)

michel-montejuado avatar Dec 05 '17 08:12 michel-montejuado

Closing... Duplicate of #8417

Brocco avatar Dec 05 '17 14:12 Brocco

Simply not working.

ng new my-proj --source-dir=src/angular

tomshaw avatar May 19 '18 01:05 tomshaw

I too had problem but it working fine now as ng new foobar --prefix foo --style scss --routing true --skip-git true --source-dir=web --dry-run

dipaktelangre avatar Mar 06 '19 05:03 dipaktelangre

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.