question: not working across node.js modules
See original GitHub issueWe have a project with multiple node.js modules. Several of them use class-validator – but they don’t work together. Each module gets its own instance of the class-validator where the decorators are stored, so they can’t share common class validation. I’ve tried the useContainer method, but that doesn’t resolve the issue.
We need some sort of solution to make all the class-validator module instances work together.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:32 (20 by maintainers)
Top Results From Across the Web
javascript - NodeJS some modules not working
NodeJS some modules not working · Yes the same way, The path is correct beacause it's in the same directory (rooms.js and fiveSocket....
Read more >Have a JavaScript Module Not Found Error? Have you ...
If you're seeing a "module not found: error: can't resolve," in your Javascript code, here's an explanation as to why and how to...
Read more >15 Common Error Codes in Node.js and How to Fix Them
Therefore, we've compiled this list of 15 common Node.js errors along ... The fix for this problem is to ensure that the target...
Read more >Node.js v19.3.0 Documentation
Indicates the failure of an assertion. All errors thrown by the node:assert module will be instances of the AssertionError class. new assert.AssertionError( ...
Read more >6 reasons your Node.js apps are failing
Problems occurring in Node.js application deployments can have a range of ... The superstack and trace modules allow you to obtain exception traces...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@NoNameProvided flattening is a workaround, not the solution. What if you have a separate module that store the shared (between frontend and backend) code, like DTOs with
class-validatordecorators?Nope. When you require the class, it uses local node_modules, so during development with
npm linkyou will have this problems withclass-validator. Been there, done that 😉 I’ve used container with weird initialization (order of require) to make it work but global metadata storage would solve all the issues.