Я начинаю изучение Express.js, и уже на моменте подключения модуля выходит ошибка
node:internal/modules/cjs/loader:1080
throw err;
^
Error: Cannot find module 'C:\Users\kiril\Desktop\PROJECTS\NodeJs\Express\backend\server'
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Module._load (node:internal/modules/cjs/loader:922:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.18.0d module 'C:\Users\kiril\Desktop\PROJECTS\NodeJs\Express\backend\index'
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Module._load (node:internal/modules/cjs/loader:922:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.18.0
Код:
const express = require("express")
const app = express()
const port = 1234
app.listen(port, () => {
console.log("work on" + port)
})
package.json:
{
"name": "file_express",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.18.2"
}
}