Search code examples
node.jsnpmhostingnestjscpanel

can not install nestjs app to hosting with cpanel


I have project with nestjs, and I am unable to install it to hosting, got this error:

returncode: 1

stdout:

start-project@0.0.1 start:prod /home/enebbvmz/server/dist

node main.js

stderr:

/home/enebbvmz/nodevenv/server/dist/12/bin/node but npm is using /opt/alt/alt-nodejs12/root/usr/bin/node itself. Use the --scripts-prepend-node-path option to include the path for the node binary npm was executed with.

[31m[Nest] 58145 - [39m06/10/2021, 7:13:28 PM [38;5;3m[PackageLoader] [39m[31mNo driver (HTTP) has been selected. In order to take advantage of the default driver, please, ensure to install the "@nestjs/platform-express" package ($ npm install @nestjs/platform-express). [39m

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! start-project@0.0.1 start:prod: node main.js

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the start-project@0.0.1 start:prod script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

npm ERR! /home/enebbvmz/.npm/_logs/2021-06-10T15_13_28_703Z-debug.log

enter image description here

enter image description here


Solution

  • First, stop you app. Your Application Root should be just server. Aplication startup file should be dist/main.js.

    Then you can click on Save Button, restart your app and click on Run Npm Install and will work.

    I recommend you create a subdomain for backend, then you can use your main domain for your frontend app.