How to change nodejs CLI version on Cpanel/Whm - node.js

On setup nodejs app in the cpanel menu, there are so many version choice.
But when I login using ssh, the shown version is v8.17.0. How to change to 12 or later?

First you need to create nodejs application on your cpanel then the NPM binary executable will be created on /home/yourcpanelusername/nodevenv/yourprojectname/12/bin/. So just use it, example:
~/nodevenv/yourprojectname/12/bin/npm install
or if using node:
~/nodevenv/yourprojectname/12/bin/node index.js

Related

I am making a website using django and tailwind css. But in Cpanel I am getting this command error of Node Js path. Any suggestions what I can do?

CommandError:
It looks like node.js and/or npm is not installed or cannot be found.
Visit https://nodejs.org to download and install node.js for your system.
If you have npm installed and still getting this error message, set NPM_BIN_PATH variable in settings.py to match path of NPM executable in your system.
Example:
NPM_BIN_PATH = "/usr/local/bin/npm"
For windows user, add
NPM_BIN_PATH = "C:/Program Files/nodejs/npm.cmd"
to settings.py
In order to find out if Node is installed on your hosting environment, you can use:
node -v
If this returns a version, then it is an indicator that there is NodeJS installed by default. And to find out the full path to the node binary, use:
whereis node
OR
which node
Once you got the full path, define it inside the settings.py of your Django.
However, if you still experience difficulties with that, I would strongly recommend finding a managed NodeJS web hosting provider that will natively have NodeJS and their support can help with such questions.

Is there a way to RUN multiple versions of Node.js simultaneously on Windows?

So, to be clear, I'm not asking about the possibility of INSTALLING multiple versions of Node, or the capability of switching between multiple versions with something like nvm.
(The original nvm package for Mac/Linux has an "exec" command that lets you run a command under a particular version of node. I think this would be a solution--but the nvm for Windows package doesn't have that "exec" command.)
Context:
I have an Azure function app API that must run under Node 14.0.0 (a requirement of Azure Function Core Tools version ~3, which itself is a customer requirement).
I also have a basic React app (using Parcel bundler) that runs under Node 11.14.0. I can't update the Node version to 14.0.0 because of an error ("Cannot locate the bindings file...").
For testing purposes, I need to run both simultaneously, so I can hit my API with my React app.
I have tried starting my API under Node 14.0.0, then using nvm to switch to 11.14.0 to run the React app, but it causes the API to fail with an "unsupported Node version" error. I haven't tried the converse approach because this error (along with the UAC prompt) tells me that the Node version in use is global.
Does anyone have any ideas of how to run two versions of Node on Windows? Or can anyone suggest another practical work-around?
Thanks in advance.

Adding a custom Node JS version to openshift doesn't work for my app

I have written an application which needs Node.js >= 4.2.6
I'm using the OpenShift service and the default Node.Js version is 0.10. Installing this https://github.com/ryanj/nodejs-custom-version-openshift is supposed to resolve this problem. So I followed the instructions and created a new application using:
rhc app create nodeapp nodejs --from-code=git://github.com/ryanj/nodejs-custom-version-openshift.git
So far so good. Next step - copy my project to the cloned git repository. Here's where I'm unsure if my approach is right (new to Node js). Because the cloned git already has a JSON package and because my app has its own JSON package in its root directory, I enriched the JSON package that came with nodejs-custom-version-openshift.git with my dependencies and set the engines to 4.2.6. The main is set to server.js. To run my app, I'm using "var variable = require('./myapp-master/test/test');" as the last line in my server.js. I copy the content of my app to the cloned repository (including node modules etc.) careful not to overwrite any existing config files like the JSON Package and then I use git push. The node version is installed properly according to the logs (upon build), servers.js is executed and it invokes my test.js. I can see in the app logs (app-root/logs) that test.js throws a specific error that indicates that the node js version is not >= 4.2.6.
When I log-in with PUTTY and write node -v, I get 4.2.6. When I navigate to my test.js and start it manually with node test.js, it runs normally. What am I doing wrong? I suspect I'm not handling the JSON packages properly (or my approach with starting my app from server.js is flawed). Any help is greatly appreciated! Thank you for your time.
Ok, I found the solution to this: https://github.com/ryanj/nodejs-custom-version-openshift/issues/2

How to run this nodejs "express-remote" application?

I am running ubuntu and I am trying to control my totem functions via my mobile. I came across this application but I am not sure how to make it work !!
I have nodejs installed and I have already run the npm install command which did not return any errors.
The link below is the github page but unfortunately does not contain my documentation on how to use it.
https://github.com/yaacov/express-remote

meteor on openShift node version

meteor (v0.6.6.3) on openShift, customized openShift nodeJS to 0.10.21, mongoDB 2.2
I try to get a meteor app running on openShift. I have upgrade the nodeJS from the openShift default 0.10.5 to nodeJS 0.10.21 because meteor needs this nodeJS version as minimum.
If i open a ssh shell to openShift and let give me the node version than it shows me correct my upgraded version of 0.10.21 ( node --version ).
But if i will start the meteor application they see a nodeJS version of 0.10.5 (console log out with 'process.version' ) and starts again, again, again...
Can someone point me to the direction where i can look what's happened or what i'm doing wrong.
thanks
I 've prepared this "quickstart" solution,
it uses METEOR + NODE v0.10.24 (but it can be changed)
with Meteor example LeaderBoard and it can be easy transformed to your real application.
I have tested on Meteor 0.7.0.1
see: https://github.com/vladka/openshift-meteor-leaderboard-customNode
Edit (06.aug.2014)
As of now openshift is running nodejs version v0.10.25 which should be fine for running a meteor app. I am currently running one that is based on the 0.8.2/3 version.
Outdated answer (20. jan. 2014)
I have found the following repo, that according to the description lets you use any custom nodejs version.
Note: I am trying it out as we speak and will report back.
Edit
After 6 hours of trying out:
2 different app bootstraps (ryanj, openshift)
3-4 different nodejs cartridges from this repo
I gave up these approaches.
But made it work via the following steps:
I downgraded meteor to 0.6.5
meteor update --release 0.6.5
Used demeteorizer to "bundle app"
Copied contents of folder into the openshift dir created by following this tutorial
Replaced process.env.ROOT_URL in meteorshim with
process.env.ROOT_URL = "http://" + (process.env.OPENSHIFT_APP_DNS || "localhost");
Updated MIN_NODE_VERSION in programs/server/boot.js with:
var MIN_NODE_VERSION = 'v0.10.5';
git push and app was up & running
Changing the version of the software installed by a cartridge is not supported, but you can make a DIY app that has the version you want or roll you own nodejs cartridge with the version you want.
I created the openshift app using nodejs-0.10 instead of nodejs-0.6.
Then i followed this repo as mentioned by Matyas.
As the final step, i added new openshift env variable, something like:
rhc env add OPENSHIFT_youruniquestring_PATH_ELEMENT=/var/lib/openshift/xxxxxxxx/app-root/data/node-v0.10.29-linux-x64/bin -a yourAppName
Please adjust the values above to match yours.
After that try to make some dummy changes to your source code, then commit and push.
Once finished, you should run on node 0.10.29.
It worked for me, my app now running on meteor 0.8.3 with node 0.10.29

Resources