0

I have a typescript project which uses node:worker_threads. However, when I try to debug individual ts files, I keep getting error

Error: Cannot find module 'node:worker_threads'

It should be noted that the problem shouldn't be in the node version, I am running node 16.19.0 and have

"engines": {
    "node": "16.x"
  }

in my package.json. Any other idea what might have gone wrong? I am running Ubuntu 20.04 on WSL2, uninstalled node via apt and set it up by nvm. Thank you

1 Answer 1

0

It seems there was some weird conflict after all. In the end, the only solution that helped was to completely uninstall node, clean up leftover files and install it again.

Sign up to request clarification or add additional context in comments.

2 Comments

It might also be a good idea to update to Node 18, as it's the current LTS. Most recent node updates tend not to have many breaking changes, but rather new features so it's usually painless. Also you only have until 11 Sep 2023 for security fixes for 16. I've noticed Linux package manager are often behind in updates, if that's how you install node, if so I would recommend you use something like nvm. github.com/nvm-sh/nvm
Oh, BTW. That other question you deleted about splitting text into 3 parts, start/middle/end, this might help -> 'firstPart second part which will be one string lastPart'.match(/^(.*?(?= )) (.*) (.*$)/).slice(1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.