Install Node and npm - Webbprogrammering/websoft GitHub Wiki
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.
Read more
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.
Prerequisite
You are familiar with the terminal and how to install programs.
Install
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
Verify that Node.js works
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
Verifiera that npm works
Verify that npm is installed and works.
$ npm --version
$ npm --help