Can anyone tell me what’s wrong here?
I am trying to finish this challenge -
Here is my solution code -
/**6) Use model.findOne() to Return a Single Matching Document from Your Database */
const findOneByFood = (food, done) =>
Person.findOne({favoriteFoods : [food]}, (error, result) => {
if(error){
done(error)
}else{
done(null, result)
}
})
// done(null /*, data*/);
};
In replit, I am getting this error as below -
Error: ENOENT: no such file or directory, open '/home/runner/boilerplate-mongomongoose/index.js'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at Object.<anonymous> (/run_dir/interp.js:195:19)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/home/runner/boilerplate-mongomongoose/index.js'
}
and getting this error from submitting it on freecodecamp challenge page -
// running tests
Find one item should succeed
// tests completed
I re-created a replit starter project from the link on the 1st page and it already gives the same error …
It seems something wrong with replit environment…
I have been stuck here for days… not sure how or where to get supports to get this resolved…
internal/fs/utils.js:269
throw err;
^
Error: ENOENT: no such file or directory, open '/home/runner/boilerplate-mongomongoose-3/index.js'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at Object.<anonymous> (/run_dir/interp.js:195:19)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/home/runner/boilerplate-mongomongoose-3/index.js'
}
Yeah I’ve been expierencing the same issue on repl.it as well lately. It’s definitely not just you. Hopefully the problem can be resolved sooner than later.
Not sure why it is trying to run an index.js file when the package.json specifies server.js. I can get it to run if I rename server.js to index.js. It doesn’t even seem to matter what is in the package.json.
Edit: It also seems to work if you edit the .replit file run command to run = "npm start server"
I opened an issue:
Edit2: Seem to be working again. But I would suggest starting fresh. Just copy your code to a new starter project.
Thanks. I tried “npm start server” and it could generate the link which passed the freecodecamp challenge, although it still gave me the same error when I clicked “run” on replit. Really no idea why…