nvm node.js use version not working - javascript

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.

Related

Node.js nvm exit status 145: The directory is not empty

I have Node.js version 14.18.1 installed and I want to update to 16.10.0 for compatibility for a project. To upgrade I have installed the latest version of nvm (1.1.8) and did nvm install 16.10.0. And then nvm use 16.10.0 and got the error: exit status 145: The directory is not empty. I tried looking this up, but couldn't find anyone on the internet encountering the same issue.
I have also tried adding the path at C:\Users\*user*\AppData\Roaming\nvm\settings.txt to my system environment path, but that didn't work either. Does anyone have an idea as to what might work? Thank you.
I solved by:
Delete all contents of folder path: C:\Program Files\nodejs
and try to run nvm use 16.10.0 again.

cPanel doesn't support node version 12.16.0

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

Want to switch between node versions, but unable to install node 8 through homebrew (currently on node 13)

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

Is there a way to downgrade my npm version to match the node-hid library?

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

How do install the LTS version of NodeJS when I already have Node 10 installed?

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.

Categories