'Cloudlinux NodeJS demands to store node modules for application in separate folder (virtual environment) pointed by symlink called "node_modules"

I was looking to deploy my Nodejs/TypeScript web application to my cpanel shared hosting. But, I am getting an error:

*

Cloudlinux NodeJS Selector demands to store node modules for application in a separate folder (virtual environment) pointed by symlink called "node_modules". That's why the application should not contain folder/file with such name in application root* enter image description here I have created a nodejs application. The final nodejs/typescript folders-files were moved to the nodejs application directory. I also was able to install TypeScript as well as run yarn install after copying my virtual environment and running it from my local terminal by running ssh.

The issues is, from my nodejs application end, I cant 'run any script' or 'npm install' neither can I from my virtual terminal. But yarn run real fine. I'm also aware that another folder was created in my root hosting path called /nodevenv/ where another instance of my domain/sub-domain name lives. enter image description here Node executables folder/files. What I dont know is, does it have anything to do with running npm script? Again, does it have anything to do with my application path?

Another weird thing I couldn't figure out is how to run the frontend and backend together. They both run fine on my local machine.

  • Do I create a subdomain for the server-side and the frontend from the main domain?
  • I want them to run together as they were running on the same port from my localhost: 8080.
  • How do I set them to run on the same port from my sharedhosting
  • What I did is, creating a proxy from the frontend package.json file like so: "proxy": "example.com" and it was running fine from local machine.


Solution 1:[1]

Remove node_modules folder. and try to run your commands again.

Solution 2:[2]

Try Moving node_modules to public folder

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yigit Tanriverdi
Solution 2 JOBIANS TECHIE