Broken test routine in Basic Node and Express - Use the .env File

Every time when I try to submit my solution for the part “Basic Node and Express Use the .env File” the programm crashed, if i try the same code in the browser the code works.

So what is going wrong hear?

SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at /home/runner/boilerplate-express-1/node_modules/fcc-express-bground/index.js:91:26
at IncomingMessage. (/home/runner/boilerplate-express-1/node_modules/fcc-express-bground/index.js:33:7)
at IncomingMessage.emit (events.js:315:20)
at IncomingMessage.Readable.read (_stream_readable.js:505:10)
at flow (stream_readable.js:1005:34)
at resume
(_stream_readable.js:986:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at /home/runner/boilerplate-express-1/node_modules/fcc-express-bground/index.js:99:28
at IncomingMessage. (/home/runner/boilerplate-express-1/node_modules/fcc-express-bground/index.js:33:7)
at IncomingMessage.emit (events.js:315:20)
at IncomingMessage.Readable.read (_stream_readable.js:505:10)
at flow (stream_readable.js:1005:34)
at resume
(_stream_readable.js:986:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
_http_outgoing.js:518
throw new ERR_HTTP_HEADERS_SENT(‘set’);
^

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:518:11)
at ServerResponse.header (/home/runner/boilerplate-express-1/node_modules/express/lib/response.js:771:10)
at ServerResponse.send (/home/runner/boilerplate-express-1/node_modules/express/lib/response.js:170:12)
at ServerResponse.json (/home/runner/boilerplate-express-1/node_modules/express/lib/response.js:267:15)
at /home/runner/boilerplate-express-1/node_modules/fcc-express-bground/index.js:108:15
at IncomingMessage. (/home/runner/boilerplate-express-1/node_modules/fcc-express-bground/index.js:33:7)
at IncomingMessage.emit (events.js:315:20)
at IncomingMessage.Readable.read (_stream_readable.js:505:10)
at flow (stream_readable.js:1005:34)
at resume
(_stream_readable.js:986:3) {
code: ‘ERR_HTTP_HEADERS_SENT’
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fcc-learn-node-with-express@0.1.0 start: node server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fcc-learn-node-with-express@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-02-07T21_59_52_366Z-debug.log
exit status 1

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

Challenge: Use the .env File

Link to the challenge:

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