skip to Main Content

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.

3

Answers


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

    Login or Signup to reply.
  2. Try Moving node_modules to public folder

    Login or Signup to reply.
  3. It’s occurring because the node_modules folder already exists, if you remove the folder, the command sent by "► Run NPM Install" button will execute successfully.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search