Basic Node and Express - Serve an HTML File

Tell us what’s happening:
Describe your issue in detail here.

Your project link(s)

solution: boilerplate-express - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36

Challenge: Basic Node and Express - Serve an HTML File

Link to the challenge:

what written in shell:
~/boilerplate-express$ npm i

added 61 packages, and audited 62 packages in 4s

7 packages are looking for funding
run npm fund for details

found 0 vulnerabilities
Detected change in environment, reloading shell…
~/boilerplate-express$

what written in console:
Error: Cannot find module ‘/home/runner/boilerplate-express/index.js’
Require stack:

  • /nix/store/qpnf0dafrfsbcwb4z7cphjm0dff0vl7l-prybar-nodejs-0.0.0-e0d9a52/prybar_assets/nodejs/module-context-hook.js
  • /tmp/prybar-nodejs-747388152.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.resolve (node:internal/modules/cjs/helpers:109:19)
    Hint: hit control+c anytime to enter REPL.

what written on myApp.js
let express = require(‘express’);

let app = express();

console.log(‘Hello World’);

app.get(‘/’, (req, res) => {
res.sendFile(__dirname + ‘/views/index.html’);
});

did you fix this already cause its showing me form on browser
image

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.