1

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?

3 Answers 3

4

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.

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

2 Comments

So if I want to develop angular 2 application with VS 2013/2015 I dont need Node js and Npm correct? Since VS comes with Typescript plugin and web server. correct me if i am wrong
I would imagine that it is possible, but I don't think it's a great idea. If you don't have npm, you'll be unable to import other libraries, and you'll be completely tied to VS. I haven't tested it myself though, so I don't really know.
3

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.

Comments

2

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.

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.