Return to site

Node Js Install For Mac

broken image

You can check your node installation just by running a small node command which will show you the version installed. Just open your cmd or PowerShell and paste the below command. This will show the version of node installed on your computer.

2
v12.16.0

Similarly, you can check the version of npm installed on your computer. Just paste the below node command to check the version.

2
v6.13.4

Running Your First App

Here you are all set up, let's try to run a small node server. Open VS Code and create a new file and save it as app.js Best games for mac.

Now paste the following code.

2
4
6
8
10
12
14
constport=3000;
constserver=http.createServer((req,res)=>{
res.setHeader('Content-Type','text/plain');
});
server.listen(port,hostname,()=>{
console.log(`Server running at http://${hostname}:${port}/`);

Now save the code and hit Ctrl + ~

This will open an integrated terminal of vs code in the same directory and from here you can directly run your js code.

Simply run the following command and hit enter.

<p>This will teach you how to debug on your own as someone might have faced a similar problem earlier.</p><p>If you still don't find any solution for your problem, you can ask your doubt in the comment's section below and we'll get back to you.</p><img src=' https://miro.medium.com/max/749/1*e69wuklte59nlev5dgi27a.png'='' alt='Node.js' title='Node.js'>

You May Also Like:





broken image