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
Related
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
I'm trying to install node version 8 (node#8) on my mac through homebrew.
My current version of node is 13.6.0, which I downloaded through homebrew, and I'd like to be able to switch between node 8 and node 13 versions for different projects.
However, when I try to download node#8 using
brew info node#8
I get the following error
Error: No available formula with the name "node#8"
To diagnose why, I ran
brew search node
And I was shown the following
libbitcoin-node node ✔ node-sass node#12 nodebrew nodenv
llnode node-build node#10 node_exporter nodeenv
It looks like my current version of node can't even search for #8. That being the case, I'd like to know two things.
What is the best homebrew (or otherwise) command sequence to get node8 on my machine, given my version of homebrew can't find node8 using brew search?
What sequence should I use to switch between the node 8 and node 13 versions on a project by project basis?
Use NVM - Node Version Manager
https://github.com/nvm-sh/nvm
You can set your default Node version and install any other versions you like.
Switching off your default version is as easy as nvm use 10.12.0 or whatever version you wish.
I have been using n for a long time now. Dead simple. To install node 8 just type:
$ n 8
https://www.npmjs.com/package/n
I am following the book "Practical Oracle JET". where I am asked to execute the following command.
ojet add sass
I get error in the log.
I am using windows server 2008r2 64
oracle jet version 6
Node version 10.16.1
NPM version 6.9
The error log I get :
verbose stack Error: node-sass#4.7.2 postinstall: node scripts/build.js
After a lot of search I realized that nod-sass#4.7.2 is not compatible with node 10. So I need to make oracle jet uses version 4.9 as the default version.
I found the file "\AppData\Roaming\npm\node_modules#oracle\ojet-cli\node_modules#oracle\generator-oraclejet\package.json"
and replaced the version number as required, but this doesn't help.
Please try installing the node-sass library manually (outside of the JET CLI command. Once the node-sass library is installed, you can then go back and run ojet add sass to get the rest of the parts installed.
from the root of your project:
npm install node-sass
--jb
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 am trying to install node.js using NVM tool (LINK to NVM)
I have Linux Mint 17 cinnamon
I have follower instructions on nvm page and everything went fine except when I run :
nvm use 0.10
it works while I am logged in on computer. When I restart computer I cannot access node shell in termninal (it says I need to install node with apt-get etc) and it works again only when I type nvm use which is annoying.
Is this normal behaviour or I am doing something wrong or there is some other problem?
Thanks,
Ivan
This is normal behaviour, but you can put nvm use 0.10 in .bashrc to avoid typing it all the time.