nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.45k stars 278 forks source link

vm Module Loader throws "request for 'net' is not in cache" #4218

Closed akwotom closed 2 months ago

akwotom commented 1 year ago

Details

I'm using the vm API in a project, where I need to provide virtual environments for code to run. However, during linking (link() method), I get the following error. Error: request for 'net' is not in cache at SourceTextModule.link (node:internal/vm/module:199:17)

Please, what am I doing wrong? I deeply appreciate your help.

Node.js version

20

Example code

No response

Operating system

Ubuntu 20 (Linux)

Scope

Code

Module and version

Not applicable.

prettydiff commented 1 year ago

Could you please provide a link to the code?

preveen-stack commented 1 year ago

Also, Can you share detailed log

akwotom commented 1 year ago

The code is part of a complex system, and wouldn't even make sense, if shared. To reproduce this, just have a situation where two modules require each other, cyclically.

prettydiff commented 1 year ago

There must be more to the problem then that because the ECMA module syntax used in the language already accounts for this. For example my browser network library and my browser web socket libraries import each other:

preveen-stack commented 12 months ago

cc @nodejs/vm

github-actions[bot] commented 3 months ago

It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.

github-actions[bot] commented 2 months ago

It seems there has been no activity on this issue for a while, and it is being closed. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.