{"id":5745,"date":"2021-11-24T05:59:12","date_gmt":"2021-11-24T05:59:12","guid":{"rendered":"https:\/\/www.cldy.com\/support\/?post_type=docs&#038;p=5745"},"modified":"2022-08-24T00:04:35","modified_gmt":"2022-08-24T00:04:35","password":"","slug":"how-to-create-a-node-js-application-with-cpanel-using-the-node-js-selector","status":"publish","type":"docs","link":"https:\/\/www.cldy.com\/support\/help\/how-to-create-a-node-js-application-with-cpanel-using-the-node-js-selector\/","title":{"rendered":"How to Create a Node.js application with cPanel using the Node.js Selector"},"content":{"rendered":"<p>For you to be able to use Node.js* applications via cPanel, you will need to run the Node.js Selector. We will help you install this using the methods listed below.<\/p>\n<p>Before you proceed, take note of the following terms used within this article:<\/p>\n<ul>\n<li><strong>app:<\/strong>\u00a0application root directory and application URL.<\/li>\n<li><strong>app.js<\/strong>: application startup file.<\/li>\n<li><strong>example<\/strong>: username.<\/li>\n<li><strong>example.com<\/strong>: domain.<\/li>\n<li><strong>My app:<\/strong>\u00a0the description.<\/li>\n<li><strong>10 or 11:<\/strong> node.js major version number.<\/li>\n<\/ul>\n<p>Make sure to alter the values as needed depending on the account and the application.<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"Method-1.3A-Setting-up-a-Node.js-application-with-the-cPanel-interface\">Method #1: Set up the Node.js application using the cPanel interface<\/h3>\n<h3 id=\"Step-1.3A-Create-the-application\">Step #1: Create the application<\/h3>\n<ol>\n<li>Log in to cPanel.<\/li>\n<li>From your cPanel cPanel home screen, go to the <em>Software<\/em> block and click on <span class=\"UI\"><span class=\"UI\"><span class=\"UI\"><span class=\"UI\"><span class=\"UI\"><span class=\"UI\"><span class=\"UI\">Setup Node.js App.<br \/>\n<\/span><\/span><\/span><\/span><\/span><\/span><\/span><img decoding=\"async\" class=\"size-full wp-image-5751 alignnone\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_setup-nodejs-app.png\" alt=\"\" width=\"206\" height=\"61\" \/><\/li>\n<li>Click on <strong><span class=\"button\">Create Application.<\/span><\/strong><br \/>\n<img decoding=\"async\" class=\"size-full wp-image-5752 alignnone\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_create-application.png\" alt=\"\" width=\"172\" height=\"32\" \/><\/li>\n<li>Complete the following fields on the succeeding page:<br \/>\n<img decoding=\"async\" class=\"alignnone wp-image-5753 size-full\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_application-setup-form.png\" alt=\"\" width=\"678\" height=\"281\" srcset=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_application-setup-form.png 678w, https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_application-setup-form-300x124.png 300w\" sizes=\"(max-width: 678px) 100vw, 678px\" \/><\/p>\n<ul>\n<li><strong>Node.js version<\/strong>: A dropdown will be available for you to choose a version you want to use.<\/li>\n<li><strong>Application<\/strong> <strong>mode<\/strong>: You will have two options: Development or Production. (You can use Development as you start and change this to Production at a later time.)<\/li>\n<li><strong>Application root<\/strong>: This is the location for your application files. Make sure to append <em>\/home\/username<\/em> to complete the path to the application files in the cPanel home directory. (Example locations: <em>\/home\/username\/appname<\/em>\u00a0or\u00a0<em>\/home\/username\/apps\/appname<\/em>)<\/li>\n<li><strong>Application URL<\/strong>: This is the web address of the application.<\/li>\n<li><strong>Application startup file<\/strong>: This will be the initial file that will run as the application opens.<\/li>\n<\/ul>\n<\/li>\n<li><span class=\"button\"><span class=\"button\"><span class=\"button\"><span class=\"button\">Make sure to complete all the required details in the form, and click on\u00a0<strong>Create<\/strong>.<br \/>\n<\/span><\/span><\/span><\/span><br \/>\n<img decoding=\"async\" class=\"size-full wp-image-5754 alignnone\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_create-application-complete.png\" alt=\"\" width=\"110\" height=\"32\" \/><\/li>\n<li>The application should start right away. Click on\u00a0<strong>Open\u00a0<\/strong>for you to see a test version.<span class=\"button\"><span class=\"button\"><span class=\"button\"><br \/>\n<\/span><\/span><\/span><br \/>\n<img decoding=\"async\" class=\"size-full wp-image-5755 alignnone\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_application-open.png\" alt=\"\" width=\"73\" height=\"33\" \/>You should see the\u00a0<strong>It Works!<\/strong>\u00a0message appear.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>By using the\u00a0<em>package.json<\/em> settings file and the npm package manager, you can now work on improving the interface of the application itself by following the next steps:<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"Step-2.3A-Create-the-package.json-file\">Step #2: Create the package.json file<\/h3>\n<ol>\n<li>Go to your cPanel homepage.<\/li>\n<li>Under <span class=\"UI\"><em>Files<\/em>,<\/span> click on\u00a0<strong>File Manager<\/strong>.<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-5759\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_files-file-manager.png\" alt=\"\" width=\"168\" height=\"59\" \/><\/li>\n<li>On the left side of the page, click on the application root location (see step 4 from earlier):<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-5760\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_application-root-folder.png\" alt=\"\" width=\"190\" height=\"94\" \/><\/li>\n<li>Click on\u00a0<strong>+File<\/strong>.<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-5761\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_application-root-folder-new-file.png\" alt=\"\" width=\"66\" height=\"30\" \/><\/li>\n<li>For the file name, type in <em>package.json,\u00a0<\/em> and click on\u00a0<strong>Create New File<\/strong>.<br \/>\n<img decoding=\"async\" class=\"alignnone size-medium wp-image-5762\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_create-new-file-300x149.png\" alt=\"\" width=\"300\" height=\"149\" srcset=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_create-new-file-300x149.png 300w, https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_create-new-file.png 500w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/li>\n<li>The <em>package.json\u00a0<\/em>file should now be visible. Right-click on the created file and click on\u00a0<strong>Edit<\/strong>.<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-5763\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_edit-json-file.png\" alt=\"\" width=\"281\" height=\"297\" \/><\/li>\n<li>A pop-up dialog box will appear. Click on <strong>OK<\/strong>.<\/li>\n<li>On the editor screen, type in the following:\n<pre class=\"code\">{\r\n  \"name\": \"app\",\r\n  \"version\": \"1.0.0\",\r\n  \"description\": \"My App\",\r\n  \"main\": \"app.js\",\r\n  \"scripts\": {\r\n    \"test\": \"echo \\\"Error: no test specified\\\" &amp;&amp; exit 1\"\r\n  },\r\n  \"author\": \"\",\r\n  \"license\": \"ISC\"\r\n}<\/pre>\n<\/li>\n<li>Click on <strong><span class=\"button\">Save Changes<\/span><\/strong>.<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-5764\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_save-changes.png\" alt=\"\" width=\"121\" height=\"34\" \/><\/li>\n<li>You can now click on <strong><span class=\"button\">Close<\/span><\/strong>.<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-5765\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_close-editor.png\" alt=\"\" width=\"61\" height=\"34\" \/><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h3 id=\"Step-3.3A-Install-npm\">Step #3: Install npm<\/h3>\n<p>&nbsp;<\/p>\n<ol>\n<li><span class=\"UI\"><span class=\"UI\"><span class=\"UI\">Once again, go to your cPanel homepage and click on <strong>Setup Node.js App<\/strong>. This should be under the\u00a0<em>Software<\/em> block.<br \/>\n<\/span><\/span><\/span><img decoding=\"async\" class=\"alignnone size-full wp-image-5751\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_setup-nodejs-app.png\" alt=\"\" width=\"206\" height=\"61\" \/><\/li>\n<li>Under\u00a0<strong>Actions<\/strong>, click on the pencil (Edit the application) icon.<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-5768\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_edit-application.png\" alt=\"\" width=\"208\" height=\"98\" \/><\/li>\n<li>Click on <strong><span class=\"button\">Run NPM Install<\/span><\/strong><br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-5770\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_run-npm-install.png\" alt=\"\" width=\"211\" height=\"42\" \/><\/li>\n<li>You should receive a prompt saying that NPM install has been completed successfully.<br \/>\n<img decoding=\"async\" class=\"alignnone size-medium wp-image-5771\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_npm-installation-complete-300x53.png\" alt=\"\" width=\"300\" height=\"53\" srcset=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_npm-installation-complete-300x53.png 300w, https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_npm-installation-complete.png 400w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/li>\n<li>On the application setup page, you can choose to &#8220;Enter the virtual environment&#8221; where you can add and install packages with NPM through SSH login. This command should be visible in the information box within the application setup page.<br \/>\n<img decoding=\"async\" class=\"alignnone size-medium wp-image-5773\" src=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_command-application-setup-page-300x51.png\" alt=\"\" width=\"300\" height=\"51\" srcset=\"https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_command-application-setup-page-300x51.png 300w, https:\/\/www.cldy.com\/support\/wp-content\/uploads\/sites\/12\/2021\/11\/cpanel_create-application-nodejs-selector_command-application-setup-page.png 557w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h3 id=\"Method-2.3A-Setting-up-a-Node.js-application-using-the-command-line\">Method #2: Set up the Node.js application using the command line<\/h3>\n<p>If you are more comfortable using SSH than cPanel, these are the steps for you:<\/p>\n<ol>\n<li>Log in using SSH.<\/li>\n<li>Use this command to create the application:\n<pre class=\"command\">cloudlinux-selector create --json --interpreter nodejs --version 11 --app-root app --domain example.com --app-uri app<\/pre>\n<\/li>\n<li>This should be the application directory:\n<pre class=\"command\">cd ~\/app<\/pre>\n<\/li>\n<li>Create the\u00a0<em>package.json\u00a0<\/em>file using this command:\n<pre class=\"command\">vi package.json<\/pre>\n<\/li>\n<li>From your keyboard, press <span class=\"user-input\">i<\/span> to change to insert mode. Add the following text into the editor:\n<pre class=\"code\"> {\r\n\u00a0   \"name\": \"app\",\r\n\u00a0   \"version\": \"1.0.0\",\r\n\u00a0   \"description\": \"My App\",\r\n\u00a0   \"main\": \"app.js\",\r\n\u00a0   \"scripts\": {\r\n\u00a0 \u00a0   \"test\": \"echo \\\"Error: no test specified\\\" &amp;&amp; exit 1\"\r\n\u00a0   },\r\n\u00a0   \"author\": \"\",\r\n\u00a0   \"license\": \"ISC\"\r\n  }<\/pre>\n<\/li>\n<li>Press the E<span class=\"user-input\">sc (escape key) and<\/span> then <span class=\"user-input\">: (colon) <\/span>to switch to command mode.<\/li>\n<li><span class=\"user-input\">Press x<\/span> and then <span class=\"user-input\">Enter<\/span> which will save your work and will let you exit simultaneously.<\/li>\n<li>Next, install the npm using:\n<pre class=\"command\">cloudlinux-selector install-modules --json --interpreter nodejs --user example --app-root app<\/pre>\n<p>Use this command to add or install other packages with npm: (you will then enter a virtual environment &#8211; see step 5 above)<\/p>\n<pre class=\"command\">source \/home\/example\/nodevenv\/app\/11\/bin\/activate &amp;&amp; cd \/home\/example\/app<\/pre>\n<\/li>\n<li>As you run the application, here are the commands you can use:stop:\n<pre class=\"command\">cloudlinux-selector stop --json --interpreter nodejs --app-root ~\/app<\/pre>\n<p>start:<\/p>\n<pre class=\"command\">cloudlinux-selector start --json --interpreter nodejs --app-root ~\/app<\/pre>\n<p>restart:<\/p>\n<pre class=\"command\">cloudlinux-selector restart --json --interpreter nodejs --app-root ~\/app<\/pre>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><em>* NOTE : Node.js Selector is only available on VPS hosting.\u00a0<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For you to be able to use Node.js* applications via cPanel, you will need to run the Node.js Selector. We will help you install this using the methods listed below. Before you proceed, take note of the following terms used within this article: app:\u00a0application root directory and application URL. app.js: application startup file. example: username. [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[47],"doc_tag":[],"class_list":["post-5745","docs","type-docs","status-publish","hentry","doc_category-cpanel"],"year_month":"2026-08","word_count":760,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"syd123","author_nicename":"syd123","author_url":"https:\/\/www.cldy.com\/support\/author\/syd123\/"},"doc_category_info":[{"term_name":"cPanel","term_url":"https:\/\/www.cldy.com\/support\/help-category\/cpanel\/"}],"doc_tag_info":[],"_links":{"self":[{"href":"https:\/\/www.cldy.com\/support\/wp-json\/wp\/v2\/docs\/5745","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cldy.com\/support\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.cldy.com\/support\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.cldy.com\/support\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cldy.com\/support\/wp-json\/wp\/v2\/comments?post=5745"}],"version-history":[{"count":28,"href":"https:\/\/www.cldy.com\/support\/wp-json\/wp\/v2\/docs\/5745\/revisions"}],"predecessor-version":[{"id":7717,"href":"https:\/\/www.cldy.com\/support\/wp-json\/wp\/v2\/docs\/5745\/revisions\/7717"}],"wp:attachment":[{"href":"https:\/\/www.cldy.com\/support\/wp-json\/wp\/v2\/media?parent=5745"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.cldy.com\/support\/wp-json\/wp\/v2\/doc_category?post=5745"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.cldy.com\/support\/wp-json\/wp\/v2\/doc_tag?post=5745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}