https://beta.freecodecamp.org/en/challenges/basic-node-and-express/meet-the-node-console
Using Glitch - below error in console on opening -
cannot read property 'stack' of undefined.
If coding console.log("Hello World"); as per challenge instructions, will print before error but not pass tests.
If attempting to run locally cannot run 'npm start' as Error: Cannot find module 'fcc-express-bground' also present.
Solved this with 'npm install fcc-express-bground' but then receive same cannot read property 'stack' of undefined error (same output as below).
Could not find node 4.4.5, using 6.12.3
2:26 PM
a few seconds ago
TypeError: Cannot read property 'stack' of undefined
2:26 PM
at Object.setupBackgroundApp (/app/node_modules/fcc-express-bground/index.js:149:31)
2:26 PM
at Object.<anonymous> (/app/server.js:25:9)
2:26 PM
at Module._compile (module.js:570:32)
2:26 PM
at Object.Module._extensions..js (module.js:579:10)
2:26 PM
at Module.load (module.js:487:32)
2:26 PM
at tryModuleLoad (module.js:446:12)
2:26 PM
at Function.Module._load (module.js:438:3)
2:26 PM
at Module.runMain (module.js:604:10)
2:26 PM
at run (bootstrap_node.js:383:7)
2:26 PM
at startup (bootstrap_node.js:149:9)
2:26 PM
Node is listening on port 3000...

This is a problem with the [fcc-express-background](https://www.npmjs.com/package/fcc-express-background) module itself, though it's hard to track down the error without the package being open sourced.
Hi @Em-Ant do you have a minute to guide us here, also is the package available in GitHub?
The package is at: https://github.com/Em-Ant/fcc-express-bground-pkg
The problem is that the package looks at the routes/middlewares on the challenge but in the first few challenges we don't need to make routes or apply middlewares. So the _routes.stack is undefined and that breaks the application.
This line breaks because router doesn't yet has routes(line 149):
var layers = myApp._router.stack.map(l => l.name)
Notice that there is an other place where similar logic is used for getting the routes(line 160):
var nowRoute = myApp._router.stack.filter(l => {
if(l.route) {
return l.route.path === '/now'
}
return false;
})
A solution would be to make a variable for the stack and default it to an empty array if there is no router
var stack = myApp._router ? myApp._router.stack : []
var layers = stack.map(l => l.name)
var nowRoute = stack.filter(l => {
if(l.route) {
return l.route.path === '/now'
}
return false;
})
Edit: something to also note that this package does enable cors, but the new https://freecodecamp.org domain is not included. Only https://freecodecamp.com
Sorry guys I saw this only today. I'll have a look during the weekend
@raisedadead I think the problem is the CORS setting. If you try this project https://marked-fowl.glitch.me where I enabled CORS for https://beta.freecodecamp.com the test pass.
We need to check all the boilerplates and add the beta domain to the array.
Ah alright. Thanks for letting me know.
@Em-Ant Can you verify whether this is still an issue now that we've launched our new learning platform? (https://learn.freecodecamp.org)
@QuincyLarson as I commented here probably We have CORS issues in many projects after the domain change. This project is one of them.
@Em-Ant OK - is that something relatively easy to fix?
We should fix them in a common way. They use different approaches.
But the simplest fix will probably require a PR for each project, and fixes in the glitch boilerplates
@Em-Ant so is there a fix for this problem yet? Running to this same issue.
The test would pass because the block is inside a try/catch. By way the error log is fixed now. @Zacele feel free to submit PRs to https://github.com/Em-Ant/fcc-express-bground-pkg until this packeage is moved under freecodecamp if you find some other problems
@Em-Ant How could I submit my projects into https://github.com/Em-Ant/fcc-express-bground-pkg?
@Em-Ant you can transfer this repo and any other repos to me, I'll take care of moving them over to the org. Also its preferable that you change the naming schema as per the boilerplates.
@raisedadead, not sure if this was transferred over to you yet. Seems to be related to, https://github.com/freeCodeCamp/freeCodeCamp/issues/17068, https://github.com/freeCodeCamp/freeCodeCamp/issues/18201, and https://github.com/freeCodeCamp/freeCodeCamp/issues/17763.
There was a PR to address the CORS issue in the boilerplate here: https://github.com/freeCodeCamp/boilerplate-socialauth/pull/1
Will circle back around and test this challenge.
Not yet, @Em-Ant can you transfer the repo over to me. See https://help.github.com/en/articles/transferring-a-repository#transferring-a-repository-owned-by-your-personal-account for help.
@Em-Ant Did you run into issues trying to transfer the repo?
the repo is transfered to @raisedadead (waiting for him to confirm). Sorry guys I didn't see the last message
The move is now complete. Thanks @Em-Ant for your help and support on this.
Repo is available here: https://github.com/freeCodeCamp/fcc-express-bground-pkg
Hi, it was working a few minutes ago, but it seems to be broken again. I have the correct Repo in package.json but still have the error "cannot find module.."
@raisedadead I notice this issue was closed, but the package.json file for the Basic Express challenges boilerplate still is referencing @Em-Ant's repo.
I will create a PR to switch to the FCC version.
Most helpful comment
The move is now complete. Thanks @Em-Ant for your help and support on this.
Repo is available here: https://github.com/freeCodeCamp/fcc-express-bground-pkg