Installing a Node.JS application on cPanel verison 80
I have installed Node.js with yum install ea-nodejs10 but version check are not working.
Following command not working.
Also node app run command not working
node --version
npm --versionAlso node app run command not working
-bash: /node: No such file or directory-
I need Run the script by executing the following at the command line. We want to run this command in a screen or something similar. node app.js
So need to use this following the command?/opt/cpanel/ea-nodejs10/bin/node app.js0 -
Hello @Nirjonadda, I recommend installing the application as a cPanel user in order to take advantage of the How to Install A Node.js Application tutorial. Using this approach, you can edit the /home/$username/.bashrc file to export specific paths to the user's environment in order to execute commands such as "npm install" from the application's source directory. Are you installing an open source application that's hosted on GitHub? If so, feel free to post the GitHub URL here and I'll provide you with the steps you should take to install it. Thanks! 0 -
Are you installing an open source application that's hosted on GitHub? If so, feel free to post the GitHub URL here and I'll provide you with the steps you should take to install it.
No, I am using Discord Integration for xenforo. Allowing the bot to appear online: This is a slightly more advanced feature that you'll need to setup yourselves. Eventually, I hope to expand this part of the add-on but until then, here's the run down:- You'll need to install node on your server. Contact your host or sysadmin if you're unsure of how to do this.
- Download the add-on's zip file, navigate to the "bot" folder in the zip root and open config.json.
- Set the token to the value you copied from your Discord Web API application when you installed the add-on.
- Set the status field to anything you want. It'll read "Playing {status}" on your server.
- Run the script by executing the following at the command line. You'll want to run this command in a screen or something similar.
node app.js
folder paths:/public_html/src/addons/NF/Discord/_extra/bot/app.js0 -
Hello @Nirjonadda, You can complete the following steps to install that application: 1. Log in to the server via SSH as the cPanel user. 2. Create the application's directory, relative to your home directory. EX: mkdir /home/$username/nodejsapp
3. Upload the application's .zip file to /home/$username/nodejsapp and unzip it within this directory. EX:cd /home/$username/nodejsapp unzip $application-name.zip
4. Browse to the extracted "bot" sub-directory and edit the config.json file per that addon's instructions. 5. From the "bot" sub-directory, complete steps 2-4 on the0 -
Let me know if you encounter any trouble with these instructions.
Not working Test the application.[nadda@na ~]$ /opt/cpanel/ea-nodejs10/bin/node app.js internal/modules/cjs/loader.js:583 throw err; ^ Error: Cannot find module '/home/nadda/app.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15) at Function.Module._load (internal/modules/cjs/loader.js:507:25) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3) [nadda@na ~]$ curl http://127.0.0.1:3000 curl: (7) Failed connect to 127.0.0.1:3000; Connection refused [nadda@na ~]$
or[nadda@na ~]$ /opt/cpanel/ea-nodejs10/bin/node /home/nadda/nodejsapp/discord_bot/app.js Aborted (core dumped) [nadda@na ~]$
How to Register the application? What need add for Application URL and Path? 586990 -
You must browse to the directory where app.js exists before running the above command.
Yes but only working in /home/$username/public_html directory, not work in /home/$username/ directory. App run closed when close the web browser tab. So how can made app running all time?Can you try installing the test application provided in the example on the
0 -
OK But please can you let me know about only working in /home/$username/public_html directory, not work in /home/$username/ directory. App run closed when close the web browser tab. So how can made app running all time?
Hello @Nirjonadda, A couple of points: 1. You can use cPanel >> Application Manager to enable the application:0 -
. You can use cPanel >> Application Manager to enable the application so it continues to run after closing your shell session or web browser tab:
Yes enabled but the application are not continues to run after closing shell session or web browser tab. 58731 58735 Also showing this error: 587390 -
Support Request ID is: 12316397 0 -
Hello, Is the issue resolved ? We are also going to work with Nodejs. Please update. 0 -
Hello, To update, the issue reported as part of ticket 12316397 was caused by custom redirect rules added to the /home/username/public_html/.htaccess file preventing the application URL from loading in the web browser. @Tarak Nath Let me know of any specific issues you encounter when installing NodeJS applications. Thanks! 0 -
Like the OP, I'm trying to install a Discord bot, but this one I made myself. Example dirs, and domain for my issue are as follows: My home: /home/jay My app: /home/jay/bots/bot.js domain: (used to register/deploy the app) bots.jaysite.com if I run /opt/cpanel/ea-nodejs10/bin/node bot.js from within /home/jay/bots the bot launches as intended, then dies when the terminal is closed (as expected). if I launch the url in my browser, i get a 403. I was previously using PM to run the bot, but that required me to remember commands to stop, and restart the bot on updates. This method will be much easier, if I can get it to work. 0 -
My app: /home/jay/bots/bot.js
Hello @jasoncollege24, The app.js file is the application's default startup file. We recommend that you create the file with this exact name because Passenger searches for this filename when it attempts to run the application. If you need to use a filename other than app.js as the application's default startup file, you must manually edit the following files: [QUOTE] /etc/apache2/conf.d/userdata/ssl/2_4/$username/$domain.tld/$nodejsapp.conf /etc/apache2/conf.d/userdata/std/2_4/$username/$domain.tld/$nodejsapp.conf
Replace the entries with the $ symbol in the file paths quoted above with the actual names associated with your specific account, domain, and application. You must open the above files in the command line text editor of your preference and add the following entries (replace index.js with the name of your preference): [QUOTE] PassengerStartupFile bot.js PassengerAppType node
Let me know if this helps. Thank you.0 -
Hello @jasoncollege24, The app.js file is the application's default startup file. We recommend that you create the file with this exact name because Passenger searches for this filename when it attempts to run the application.
Thank you! Renaming the file to app.js allows it to run the way it's expected. Just one more issue to resolve, and I'm good. if I go to my example url of bots.jaysite.com my Discord bot comes online, and does exactly what I expect. Problem is that about a minute, or two after closing the browser tab, the bot goes offline. I need this app to continue running after the browser tab is closed.0 -
if I go to my example url of bots.jaysite.com my Discord bot comes online, and does exactly what I expect. Problem is that about a minute, or two after closing the browser tab, the bot goes offline. I need this app to continue running after the browser tab is closed.
Can you confirm that you've registered the application in Production Mode using cPanel >> Application Manager ? This should allow the application to start and remain running without the need to visit the application URL in a web browser. Otherwise, if you can reproduce the same behavior with an open-source application, let me know the link to the application's GitHub and the full instructions you are using to to reproduce the behavior. Thank you.0 -
I found a workaround that is easier for me to accomplish than getting cpanel to do it. With ea-nodejs10 installed, I created a custom service in CentOS 6.10 that uses node.js to bring the bot online via /etc/rc.d/init.d Logged in as root via SSH, I can use the following commands on the bot... service mybot start - starts the bot, and creates a lock file in the app's tmp directory service mybot stop - stops the bot, if it's running, and deletes the lock file service mybot restart - executes the stop command, then the start command on this service service mybot status - gives a message indicating whether the service is running, based on the existence of the lock file. 0 -
We have installed the test application provided in the example on the How To Install A Node.JS Application tutorial and we are successfully able to see the server running via SSH. We then also have registered the application using cPanel >> Application Manager to enable the application under the document: - Application Manager - Version 78 Documentation - cPanel Documentation But we are unable to see result of nodejs app in web browser using our domain link. The difference in our case is domain is mapped to jvm as our backend API are on Java and nodejs app directory is inside jvm directory. Please can you let us know it will work or not if nodejs testapp is in /home/$username/jvm/Apache tomcat 8.5/domains/my domain.com/Root/testapp directory. If not, please let us know how to make Java backend and Nodejs app work together using cPanel. FYI, for our website, our frontend is in Angular 6 and backend in Java spring. Urgent kelp needed please. 0 -
What, if anything is noted in the related error logs when trying to view the site? 0 -
What, if anything is noted in the related error logs when trying to view the site?
No. As mentioned The difference in our case is domain is mapped to jvm as our backend API are on Java and nodejs app directory is inside jvm directory. If jvm is mapped, Apache web server always routes to jvm, can mode_passenger still route? Please can you let us know it will work or not if nodejs testapp is in /home/$username/jvm/Apache tomcat 8.5/domains/my domain.com/Root/testapp directory.0 -
@cPanelMichael plzz help in a issue with cpanel i have uploaded my app in file manager and run it from nodejs it successfuly installed its pkgs but after that its not working proprly as it works on localhost plzzz visit this my domain Index of / and help regarding this 0
Please sign in to leave a comment.
Comments
26 comments