skip to Main Content

I did install WSL2 and ubuntu 22.04 distribution on windows 11. I configured envoirment, installed nvm, node v.16.17.1, next in my folder did npm init, installed express, created index.js file within simple structure:

const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => {
  res.send('Hello World!')
})

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})

When i tap node index.js nothing happen.
image

In my second computer with ubuntu 20.04 distribution everything work fine. Does anyone know what to do?

2

Answers


  1. Chosen as BEST ANSWER

    Problem resolve. File need to be SAVE before calling from terminal....


  2. How about doing debugging by referring to https://expressjs.com/en/guide/debugging.html?

    like this,

    DEBUG=express:* node index.js
    

    If no other problem is found, it would be good to use the --inspect options.
    https://nodejs.org/en/docs/guides/debugging-geting-started/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search