Summary
server/index.js is the backend entry point (server/package.json sets "main": "index.js" and "start": "node index.js"). It currently contains leftover merge conflict artifacts, so the file is not valid JavaScript and the backend cannot start.
Details
The problem is a block at lines 14 to 18:
- Line 14 is a bare branch name
feature/login-auth sitting as code. It evaluates as feature / login - auth and throws ReferenceError: feature is not defined at runtime.
- Lines 17 and 18 redeclare
const fs and const path, which are already declared at the top of the file (lines 8 and 9). A const redeclaration is a hard parse error.
The same block also repeats app.use(cors()) and app.use(express.json()), which duplicate the security middleware configured later (lines 58 to 63: helmet(), a CORS policy restricted by CLIENT_URL, and express.json({ limit: '2mb' })). The plain app.use(cors()) also re-opens CORS to all origins before the restricted policy runs.
Steps to reproduce
- On
main, run node --check server/index.js.
- Observe:
server/index.js:17
const fs = require('fs');
^
SyntaxError: Identifier 'fs' has already been declared
Starting the backend (npm start inside server/) fails the same way.
Expected
server/index.js parses as valid JavaScript and the backend starts.
Actual
node --check fails with SyntaxError: Identifier 'fs' has already been declared. The backend cannot start.
Suggested fix
Remove the leftover merge block (lines 14 to 18): the feature/login-auth line, the duplicate const fs and const path, and the duplicate app.use(cors()) and app.use(express.json()). Keep the existing top level requires and the restricted security middleware block already present below.
Notes
This is one part of a recent bad merge. server/package.json is also currently invalid JSON, which blocks npm install inside server/; that is a separate report. Both are required for the backend to install and boot.
I would like to work on this issue.
Summary
server/index.jsis the backend entry point (server/package.jsonsets"main": "index.js"and"start": "node index.js"). It currently contains leftover merge conflict artifacts, so the file is not valid JavaScript and the backend cannot start.Details
The problem is a block at lines 14 to 18:
feature/login-authsitting as code. It evaluates asfeature / login - authand throwsReferenceError: feature is not definedat runtime.const fsandconst path, which are already declared at the top of the file (lines 8 and 9). Aconstredeclaration is a hard parse error.The same block also repeats
app.use(cors())andapp.use(express.json()), which duplicate the security middleware configured later (lines 58 to 63:helmet(), a CORS policy restricted byCLIENT_URL, andexpress.json({ limit: '2mb' })). The plainapp.use(cors())also re-opens CORS to all origins before the restricted policy runs.Steps to reproduce
main, runnode --check server/index.js.Starting the backend (
npm startinsideserver/) fails the same way.Expected
server/index.jsparses as valid JavaScript and the backend starts.Actual
node --checkfails withSyntaxError: Identifier 'fs' has already been declared. The backend cannot start.Suggested fix
Remove the leftover merge block (lines 14 to 18): the
feature/login-authline, the duplicateconst fsandconst path, and the duplicateapp.use(cors())andapp.use(express.json()). Keep the existing top level requires and the restricted security middleware block already present below.Notes
This is one part of a recent bad merge.
server/package.jsonis also currently invalid JSON, which blocksnpm installinsideserver/; that is a separate report. Both are required for the backend to install and boot.I would like to work on this issue.