can not install nestjs app to hosting with cpanel - node.js

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

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.

Related

Nestjs failed to deploy on cpanel

I'm trying to deploy my backend application on cpanel and I'm getting an error like this
what should i do to solve this problem?
> test3#0.0.1 start /home/nandaken/inventory
> nest start
stderr:
npm WARN lifecycle The node binary used for scripts is /home/nandaken/nodevenv/inventory/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.
sh: nest: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! test3#0.0.1 start: `nest start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the test3#0.0.1 start 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/nandaken/.npm/_logs/2023-01-28T08_16_43_494Z-debug.log
Looks like cpanel is calling the startscript which is running nest start. More than likely, you only have production dependencies installed, so #nestjs/cli isn't installed because it is a devDependency. Either configure cpanel to call a different start script (like start:prod which should map to node dist/main) or change your start script to run the proper js file (like node dist/main). The other option would be to install #nestjs/cli as a production dependency, but I wouldn't suggest that

Unable to run Node.js app on DirectAdmin shared hosting: sh: /.../nodeApp/node_modules/.bin/nodeApp: Permission denied

I am trying to start a node app on a DirectAdmin shared hosting. Due to limitations of that particular hoster, I could not run npm install; I had to upload the entire app, node_modules included. Now, when I attempt to npm run start the app from the node virtual environment, the script fails with the following error:
sh: /.../MyNodeApp/node_modules/.bin/MyNodeApp: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! MyNodeApp#0.1.0 start: `MyNodeApp start`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the MyNodeApp#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I have followed the steps in the Resolving EACCES permissions errors when installing packages globally NPM guide for this, but I am still getting the same error.
How can I start the app?

npm cannot find index.html when launching REACT front end

The problem occurs when I try to launch the front end of the app. I do this from within the frontend directory with the command: npm start. It is a MERN stack application. I am using git for version control. Others with access to the git can run npm start with no problems on their machines, so I think the problem could be related to the windows file or path systems, but haven't been able to find out.
The error given:
Could not find a required file.
Name: index.html
Searched in: C:\Users\Liam\OneDrive\Desktop\COP4935\Project\DemocracyToken\public
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend#0.1.0 start 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! C:\Users\Liam\AppData\Roaming\npm-cache\_logs\2021-09-03T17_01_09_900Z-debug.log
npm appears to be trying to access the public directory from the project root (DemocracyToken) when the public directory is located in DemocracyToken/frontend/
I have tried:
rerunning npm install,
uninstalling and reinstalling node,
moving the location of the public folder,
and moving the location of index.html.
Here is the file structure of our app:

Error using Framework7 and service.js for hosting in the local host

when i clicked the npm run service. This error is what i am getting
I have used the same app in the following link:
https://github.com/valnub/f7-node-autocomplete-search-demo
framework7-react-app-template#3.0.0 service C:\Users\Tallam Tharun Sai\auto-complete
PORT=3001 nodemon service/service.js
'PORT' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! framework7-react-app-template#3.0.0 service: `PORT=3001 nodemon service/service.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the framework7-react-app-template#3.0.0 service 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! C:\Users\Tallam Tharun Sai\AppData\Roaming\npm-cache\_logs\2020-07-10T18_16_54_175Z-debug.log
The answer for this is.
I have deleted the Package.json and Node modules from the project and again followed the steps to install the npm as (npm install).
Then I have the installed my npm app successfully.

Can't start react native project with npm start

First i started with installing npm (version ) then expo cli (version ) then i initialise a project normaly then when i start my project with npm start and also expo start a get this message :
Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
ConfigError: Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
at Object.getExpoSDKVersion (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\config\src\Project.ts:22:9)
at ensureConfigHasDefaultValues (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\config\src\Config.ts:419:22)
at fillAndReturnConfig (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\config\src\Config.ts:101:10)
at getConfig (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\config\src\Config.ts:137:10)
at configureProjectAsync (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:288:25)
at action (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:164:34)
at C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:341:16
at Command.<anonymous> (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:82:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: expo start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # start 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! C:\Users\BILAL\AppData\Roaming\npm-cache_logs\2020-05-17T00_34_22_028Z-debug.log
also i worked with react native and react-cli before for a simple app and it worked but this time i tried for a week without result
thank you so much

Resources