We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm trying to create a JSON file after running node, and then require it.
This code works fine.
When I tried to require the file inside try-catch before creation, I wasn't able to require it after creation.
Error:
This error related to my second requires, since the first one is inside trying catch. Meanwhile, my file was created.
I thought there is a cache, so I need to delete the value for my file from require.cache.
require.cache
But it didn't help:
Could you please help me to understand how Node.js works in this case? And how can I solve this issue?
The text was updated successfully, but these errors were encountered:
It seems failed requires are not cached:
try { require('./test.json'); } catch (err) {} console.log(require.cache); // no json entries
Sorry, something went wrong.
Reported in nodejs/node#36638
This issue was reported as a bug in nodejs/node here. It was fixed in this PR.
No branches or pull requests
I'm trying to create a JSON file after running node, and then require it.
This code works fine.
When I tried to require the file inside try-catch before creation, I wasn't able to require it after creation.
Error:
This error related to my second requires, since the first one is inside trying catch. Meanwhile, my file was created.
I thought there is a cache, so I need to delete the value for my file from
require.cache
.But it didn't help:
Could you please help me to understand how Node.js works in this case? And how can I solve this issue?
The text was updated successfully, but these errors were encountered: