-
Notifications
You must be signed in to change notification settings - Fork 56
Install Node and npm
We will install an environment for JavaScript. It's about Node.js and the package manager npm.
The environment means that you can run JavaScript on your computer and you can access all the programs and packages offered through the package manager npm.
You can read more about Node.js on the site.
You can read more about npm on the site. There you can also search for the packages that are published.
You are familiar with the terminal and how to install programs.
Go to the Node Download Page. Download the installer and install.
The node and npm programs are automatically added to your PATH.
You can now start the programs from the windows terminal cmd
. But restart your terminal so that it gets part of the updated path.
node --version
npm --version
You can now run JavaScript with node. Try the following.
$ node --help
$ node --eval "console.log('Hello World');"
Hello World
You can also run node interactively and evaluate JavaScript line by line. The program shows that it is ready for entry with the prompt >
.
$ node
> console.log("Hej")
Hej
>
You can also let nodejs run JavaScript programs that are in files.
$ echo "console.log('Hello')" > hello.js
$ node hello.js
Hello
Verify that npm is installed and works.
$ npm --version
$ npm --help
.
..: Copyright (c) 2020 Mikael Roos, [email protected]