39

Why is Node.js required in order to use Angular?

In other posts, people say that it isn't required, and that it's only needed if you want server-side code. But the Angular documentation specifically states the need for Node.js in the "Getting Started" section. Why exactly is Node.js required? What if I want to use .NET Core as my server side back-end?

Straight from the Angular site:

Prerequisites before you begin, make sure your development environment includes Node.js® and an npm package manager.

Node.js Angular requires Node.js version 8.x or 10.x.

To check your version, run node -v in a terminal/console window.

To get Node.js, go to nodejs.org.

3
  • 5
    you don't need node.js to run your application, but you need node.js to develop your angular app to use necessary tools. Commented May 21, 2019 at 4:00
  • 1
    NodeJS gives you the tool npm that allows you to download libraries and packages that you use in Angular. You can use .NET server side backend. Commented May 21, 2019 at 4:10
  • You need to install, run, test, build using npm commands, npm comes with nodejs hence the requirement, it's just the essential tools you need for development, you can use any other technology as your backend. Read again: Before you begin, make sure your development environment includes Node.js® and an npm package manager. Commented May 21, 2019 at 4:10

4 Answers 4

52

Angular does not need Node.js directly and it is not mandatory to use Node.js. But you will need Node.js for all the build and development tools.

For an example these are few reasons that you need Node.js for building an Angular app,

  • npm (node package manager) comes with Node.js by default and it allows you to manage your dependencies. So, you don’t have to worry for operations like adding a dependency, removing some, updating your package.json.

  • npm gives you angular cli or ng cli (angular command-line interface) which is a great tool for building your application easily

  • Node.js allows you to spin up a lightweight web server to host your application locally in your system.

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

2 Comments

Thank you for your clear explanation on this. I understand now that Angular can be ran without node.js, but that node.js is very helpful (if not essential) in the development of angular code/apps
But at the end the angular app runs over a node server right? I guess when I deploy it in aws or heroku these platforms runs a server and runs my angular application. Thanks a lot.
5

You do need Node.js to develop Angular applications. All the tools you will run, while developing it, uses Node.js to run, like npm and the Angular CLI itself.

Node.js will serve your application on your machine. It has nothing to do with the server-side of your application, which can be any language you want.

Comments

1
  • Node.js allows you to spin up a lightweight web server to host your application locally in your system
  • NPM comes with node.js by default - used to manage dependencies so you don't need to worry about adding/removing dependencies (to node_modules folder, package.json/package.lock.json files)
  • NPM gives -> Angular CLI which is used to initialize,develop,scaffold & maintain angular application directly from command shell. It uses webpack for bundling your applications.

Also Angular uses TypeScript but browser understands Html & JavaScript only -> Typescript is transpiled into JS. Angular CLI does all these behind the scene.

Comments

1

Node.js needed for all the build and development tools.

npm (node package manager) comes with Node.js by default that will manage all dependencies

npm gives you angular cli or ng cli

Node.js allows you to spin up a web server to host your application locally in your system.

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.