user3528733
user3528733

Reputation: 1299

Why angular 2 need node.js

I don't have experience in front-end but I want to create a simple app using Angular 2.

Why do I need to install Node.js as a prerequisite step? Why does Angular use Node.js?

Upvotes: 1

Views: 2701

Answers (3)

Aurora0001
Aurora0001

Reputation: 13567

There are a couple of things that Angular uses Node.js for:

Angular application developers rely on the npm package manager to install the libraries and packages their apps require. The Angular team recommends the starter-set of packages specified in the dependencies and devDependencies sections.

  • Compiling the TypeScript used into JavaScript that the browser understands - browsers can't process TypeScript natively and the SystemJS imports used in your code aren't supported in browsers yet:

We strongly recommend transpiling (AKA compiling) to JavaScript during a build phase before running the application for several reasons including:

We see compiler warnings and errors that are hidden from us in the browser.

Precompilation simplifies the module loading process and it's much easier to diagnose problems when this is a separate, external step.

Precompilation means a faster user experience because the browser doesn't waste time compiling.

We iterate development faster because we only recompile changed files. We notice the difference as soon as the app grows beyond a handful of files.

Precompilation fits into a continuous integration process of build, test, deploy.

Upvotes: 4

Chandan
Chandan

Reputation: 1138

For any modern JS based application, as the complexity grows, the app becomes difficult to manage. In order to make developing and managing complex applications simpler, there are frameworks such as Angular, React etc. and they provide number of tools for the same.

These tools are linting, scaffolding, running unit test cases, starting web server for local development, minify and creating build for the production use etc.

These tools are based on NodeJS as it is JavaScript only and therefore can be customize as per developers needs. And that's the reason you need Node.js for Angular2 development.

Upvotes: 2

Wawy
Wawy

Reputation: 6269

node.js is required in order to install the library using the node package manager (npm).

It is not required to run an app using angular2, only to build it.

Upvotes: 3

Related Questions