I want to host my node api (built in node version 12.16.0) on cPanel, but available version for node in cPanel is 12.9.0 (Most recent). What should I do now ? Does it really matter, the node version ?
Although 12.18.2 is LTS on the current date, but I think you can move ahead with 12.9 as well. It is a minor update.
In case you want to manage the version then you should use nvm node version manager. Using nvm you can manage the latest version as default on your server.
Make sure to install the latest version of Node Js before setting that as default version on your server. and you need to install nvm as well.
Use the following commands:
nvm install 12.18.2
nvm alias default v12.18.2
Related
I'm using Google Cloud Shell, and the default node version is 12.14.1. Is there an easy way to update the node version to 14.x or 16.x?
node seems to be installed with nvm
$ which node
/usr/local/nvm/versions/node/v12.14.1/bin/node
Apparently one can simply use nvm command to change the version. When I tried:
nvm install 14
I was upgraded to 14. I think I can install/change my node versions as desired.
nvm isn't a file, but a bash function and is exposed via /google/devshell/bashrc.google.d/nvm.
This script is sourced by default by /google/devshell/bashrc.google. However, I inadvertently commented out these lines, which disabled it
if [ -f "/google/devshell/bashrc.google" ]; then
source /google/devshell/bashrc.google
fi
For anyone who's curious, those lines are put in there by /etc/profile.d/restore_bashrc.sh.
If you ran into a similar issue and want to fix it manually, you can add the following lines to your .bashrc
for FILE in /google/devshell/bashrc.google.d/*; do
if [ -f "$FILE" ]; then
source "$FILE"
fi
done
Dec, 2021 Update:
This installs the latest LTS version:
nvm install 16.13.1
If you don't mind the specific version:
nvm install 16
In addition, this installs the latest Current version:
nvm install 17.3.0
If you don't mind the specific version:
nvm install 17
Using node.js, I wanted to create a kiosk application with a RFID Reader attached to the kiosk. In order to access my RFID Reader, I installed the node-hid library (https://github.com/node-hid/node-hid). However, when I tried to run the application, an error occured, says:
Uncaught Exception
Error: The module 'D:\Projects\Electron\SelfService\node_modules\node-hid...\build\HID.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 72. This version of Node.js required NODE_MODULE_VERSION 73.
I already updated the library and the node.js version to the latest update, but since the library is kinda old, it doesn't get any more update.
I tried to downgrade the node version, however there aren't any helpful tutorial I can find out there. I know there are many tutorial that explained how to install the older version of node, but I can't simply know what version of node I need from the error message displayed above.
I need to get the device readable by the application. If somehow, it's impossible to use the node-hid library, what is the latest library you recommended to access the RFID Reader from the application?
Note: I'm familiar with web development, including Javascript language, but Node.js is a new experience for me. I'll try my best to provide informations regarding my project, but if there are some mistakes with how I described my problem or if I have some difficulties in understanding your answers, please bear with me.
EDIT: I forgot to mention I'm on Windows 10, the node version I installed is 10.16.3
First Try this command -
Uninstall the electron first then try below command
sudo npm install --save-dev electron#4.0.0
sudo npm i --save-dev electron-releases#4.0.0
And also try to update chrome
Above is solution be sure minimum using Linux 16.04 with x64 processor and for npm version change see below
For NPM Version Downgrade of Linux/Ubuntu
sudo npm install -g npm#version
example-
sudo npm install -g npm#6.9
For Windows - start command prompt administrator
npm install -g npm#version
example-
npm install -g npm#6.9
You can uninstall the current node and then re-install the desired node version.
But the best practice will be installing node.js using the nvm aka node version manager.
Using nvm you can easily switch between different node version as well as different npm version.
Here's a quick start for installing node using nvm in both
windows, linux and unix platform.
NVM Official doc for unix and linux.
NVM alternative for windows
I download Node 10.11 a few weeks back and I have a repo that requires me to have the LTS version of Node of 8.12 at the time of this question. if I download the LTS will that mess up the install I have already or will it overwrite it? I'm using a Mac with High Sierra Also without using NVM
You can use nvm and have multiple versions of node on the same machine and switch by doing "nvm use version".
I can't comment yet, but to answer your question posed to Giorgos...
"So can I install NVM without uninstalling the version of Node I have already on my mac? "
Correct. NVM allows you to install whatever versions of Node you want and switch between them whenever you want. You can also set it so certain projects run a specific Node version so you don't have to worry about switching between versions if you are jumping between projects.
This allows you to have old versions, say 0.12 for random things, but also have Node8.x.x for your one project, and Node 10.x.x for another. It is incredibly useful, and if you ever need to verify compatibility with a new version, you can install the Node version via NVM and run your tests/project with that version of node. If it works, you can stick with it, if not you can switch back and look into updating your code to work with a new version.
When using Node Version Manager, I can set the version of node to the latest version in the current directory with nvm use node. How do you specify which version to use?
Let's say you have versions v8.2.0 and v8.3.0 installed.
To make version v8.2.0 the currently used one, you can call nvm use 8.2.0.
nvm use also accepts aliases, so you could create one like this:
nvm alias mysuperversion 8.2.0 and then make it the current one by calling nvm use mysuperversion.
To make a specific version of Node a global one, you should create a default alias (or modify it if it already exists, the same way you create a new one).
nvm use VERSION
if VERSION is 12.22.6, the command to use this version is
nvm use 12.22.6
You must install a version before using it. To install a version, the command is:
nvm install VERSION
If you wish to alias your versions, then you would use the command:
nvm alias mynodeversion 12.22.6
nvm use mynodeversion
I am starting to learn Nodejs and tried to install it.
Now, when I do node -v I get v4.4.4 and when I do nodejs -v, I get v0.10.45
which node gives /usr/local/bin/node, which nodejs gives /usr/bin/nodejs
I need v4.4.4. Because of those different results I am not sure to start.
What can I do?
I recommend installing NVM (node version manager). It makes dealing with multiple node version installations really nice. Digital Ocean has a good tutorial on doing that here:
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-an-ubuntu-14-04-server
Once you've installed NVM you can likely remove your other node versions and all of your programs that use node will default to whatever version you set as the default with nvm.