4

My motive is to create a UI library of my own using Angular 9. I was going through the Angular official documentation about Creating Libraries. They started with this command:

ng new my-workspace --create-application=false

And they say that --create-application=false will instruct the CLI to create the config file only and not the application code. Out of curiosity I created 2 projects one with this parameter and other one I generated normally with ng new my-project just to see what is the difference between project structure. I'm confused to see both are same.

Left one is without parameter while Right one is with parameter: enter image description here

Please correct my mistake.

My versions are:

Angular CLI: 6.2.9

Node: 10.19.0

OS: linux x64

Here is a recording of my steps: https://youtu.be/wsedP3DAsl4

6
  • I think you are comparing the full project to itself. I just did the same thing you describe and the CLI produced exactly what is expected. 2 completely different results; one with the minimum files, one with all the scaffolded files for an angular application. Commented May 6, 2021 at 19:32
  • @R.Richards. this is strange. I again created one more workspace using ng new --create-application=false and again I can see all the files including app component and other application code. I'm adding my versions in the question. Commented May 7, 2021 at 3:00
  • @R.Richards, Can you please upload your project folder's screenshot somewhere. I want to tally few things. Please. Commented May 7, 2021 at 3:04
  • @R.Richards, Here i've uploaded a screen recording of my steps: youtu.be/wsedP3DAsl4 Commented May 7, 2021 at 3:12
  • 1
    --create-application is not a valid option for that version of the CLI. Think about upgrading to the latest version. You could have found this out yourself by running ng new --help and see that option is not listed. Commented May 7, 2021 at 11:08

5 Answers 5

6

I'm using Angular CLI: 15.2.4, so, in order to work the command I used ng new myApp --create-application=false and works.

C:

Sign up to request clarification or add additional context in comments.

Comments

3

The --create-application flag is used with the ng new command. Setting this to false tells ng new not to create the initial Angular application in the Workspace. By default this flag is set to true to match the behavior of the previous versions of Angular CLI.

More info at this Medium blog post: Angular In Depth

So the difference is that you can create multiple 'projects' that share the same workspace instead of having one workspace for each project that would mean having one node_modules folder and so on..

Comments

1

You can use --no-create-application as below:

If you plan to have multiple applications in the workspace, you can create an empty workspace by using the --no-create-application option. You can then use ng generate application to create an initial application. This allows a workspace name different from the initial app name, and ensures that all applications reside in the /projects subfolder, matching the structure of the configuration file.

enter image description here

1 Comment

Here the documentation link : angular.dev/cli/new
0

Look I had this error Error: Unknown argument: createApplication then what I do is use sudo like this sudo ng new my-workspace --createapplication=false and it works.

Comments

0

maybe resolve your problem:

  • ng new my-workspace --skip-install

  • Remove ./src

  • ng generate application [name] --style=[name] --routing=[boolean]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.