I created a node js project that utilizes worker threads. The code works fine when I run npm start in VS Code. But when build and copied in Ubuntu server, it show "Cannot find module 'worker_threads'".
Is there additional configuration that must be done when deploying node js with worker threads in production? By the way here how I deploy it in Ubuntu server.
1.) since my project is typecript, I compiled it using 'tsc' command 2.) the 'tsc' command produced 'build' folder 3.) I copied the package.json and package-lock.json into the 'build' folder 4.) zip the 'build' folder and transfer to Ubuntu server using 'scp' command 5.) in Ubuntu server, I unzip the the 'build' folder 6.) I run 'npm install' in the 'build' folder to download dependencies 7.) I the run my program with 'node ./src/main.js' and also 'pm2 start ./src/main/js' to no avail
Other projects without the worker threads deployed without problem using above procedure.
Thanks in advance!