V
V
Vladimir2022-02-12 00:11:01
Node.js
Vladimir, 2022-02-12 00:11:01

The project does not start with the node app.js command, how to fix it?

Hello. There is a simple server on express, apart from express, no packages are installed. node version: 16.14.0. express version: 4.17.2.
When you try to run through node app.js - nothing happens, the command hangs like this for a very long time or until you kill the ctrl+c process. BUT! If you run it through nodemon app.js (which I'm used to), everything works. I didn’t even notice, I wrote the project for 4 days, it came to deployment, and here it’s such a joke. I have no idea what to do if I output only console.log(1) in app.js - it starts.

If you run with express connected, even like this, it freezes:
app.js

const express = require('express');
const app = express();
app.get('/', (req, res) => {
   res.sendFile('./auth.html');
});
app.listen(3000);


Here is package.json:

{
  "dependencies": {
    "express": "^4.17.2"
  },
  "name": "map",
  "version": "1.0.0",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/"
  },
  "homepage": "https://github.com/",
  "description": ""
}


I cleaned npm uninstall npm, reinstalled node on the host to version 16.0 linux, to no avail, put the last version on my computer and it also began to freeze, maybe it was like that before, but in my opinion it was not like that. Tell me how I can quickly solve this issue, I've been stuck in one place for 2 hours, I can't turn in my work. Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question