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?
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?
Share Improve this question edited Jul 31, 2016 at 1:37 Sufian 6,55517 gold badges71 silver badges123 bronze badges asked Jul 30, 2016 at 11:54 user3528733user3528733 1,2998 gold badges21 silver badges38 bronze badges3 Answers
Reset to default 4There are a couple of things that Angular uses Node.js for:
- Installing and managing packages. From the Quickstart tutorial:
Angular application developers rely on the npm package manager to install the libraries and packages their apps require. The Angular team remends 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 remend transpiling (AKA piling) to JavaScript during a build phase before running the application for several reasons including:
We see piler warnings and errors that are hidden from us in the browser.
Prepilation simplifies the module loading process and it's much easier to diagnose problems when this is a separate, external step.
Prepilation means a faster user experience because the browser doesn't waste time piling.
We iterate development faster because we only repile changed files. We notice the difference as soon as the app grows beyond a handful of files.
Prepilation fits into a continuous integration process of build, test, deploy.
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.
For any modern JS based application, as the plexity grows, the app bees difficult to manage. In order to make developing and managing plex 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.