Re-installing Node JS failed - node.js

I am using RHEL 6.
I needed to uninstall NodeJS and install a different version of it.
I found various methods for uninstalling it and as instructed deleted all the node and npm related files.
But when i try to install it again i get the following error -
Package nodejs-6.2.1-1nodesource.el6.x86_64 already installed and latest version
Nothing to do
Any help ?

Related

Sorry, there's a problem with nodist. When trying to initilise a new npm project

I am following the following guide from GitHub Here but when I enter npm init I keep getting the error:
Sorry, there's a problem with nodist. Couldn't resolve node version
spec %s: %s 11.13.0 Couldn't find any matching version
I have followed the previous steps and set the version to v10.15.3, but the error keeps appearing every time I use nvm. I have also set the version to v11.13.0, as this is what the error is requesting, but I still get the same result. Installed versions include: 11.13.0, 10.16.0, 10.15.3, 8.11.2, 0.12.0
Any help with this would be much appreciated!
There are several reasons which can cause this problem:
If due to some reasons like poor internet connection your node or npm versions you have downloaded are corrupted. In this case you need to remove the files .npm-version-global and .node-version-global as well as empty the folders v, v-64 and npmv within the installation of the Nodist folder.
You have a local version of the node specified in .node-version file in the root directory of your project. In this case you need to install that version by nodist local XXX where XXX is the version of the node in .node-version file.
In my case, the problem was that I had a node version specified in my code repo that didn't match the node version installed on my machine. I needed the updated node version on my machine, so
I opened file explorer to the root of my repo.
I opened .node-version and edited the version number to the updated version I needed.
npm cache clean --force to start with a fresh cache. (Note: Others have said that npm cache clean --force is outdated, but this command worked for both my teammate and for me using npm version 6.9.0.)
npm install to reinstall my node modules.
npm run build and I had a clean build. Yay!
For Node 18 and npm 8.19.1, I found the advice at https://github.com/nullivex/nodist/issues/252#issuecomment-1170897428 useful.
I was getting cb.apply errors, and problems with #npmcli/arborist and libnpmfund, but I created those two links from the list.
I was using npx. This installs an old (v 5.8) version of npm inside its node_modules. That npm contains graceful-fs inside its node_modules. The cb.apply error was coming frome graceful-fs's polyfill.js.
I installed the latest version of graceful-fs, and copied the newer polyfill.js into the abovementioned (child of npm's) graceful-fs. This seemed to fix the problem for me.

npm not compatible with node v12.5 on ubuntu 16.04

I tried updating to v12.5. I was using node version 8 before this. When I installed node v12.5 npm stopped working.
Whenever i try installing any package with npm. It shows this error.
I tried deleting node through different sources. But, it did not work.
I also tried reading different articles like these
https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/
https://websiteforstudents.com/install-the-latest-node-js-and-nmp-packages-on-ubuntu-16-04-18-04-lts/
https://www.rosehosting.com/blog/how-to-install-node-js-on-ubuntu-16-04/
I almost tried all the sources available on web.
I tried
sudo apt purge node
sudo apt autoremove
and some similar commands. But, it did not work.
Whenever i type node -v. it still shows me 12.5
and when i type npm -v. it shows me 5.5.1.
How do i either remove node completely?
or
install specific version of node?
or upgrade npm to version 8.x
How do I solve the problem?
I cannot even install anything, it shows this error even after installing some other packages.
how do i solve it?
EDIT:
I found the solution...
its basically using nvm to install different versions of node in your machine.
and setting default version for your machine using nvm

NPM Install 404 Resource

after this command:
npm install node-sass
it throws this error:
Cannot download
"https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node":
I'm using the Node.js command prompt, I did npm update 5 times, it still tries to download from a 404 repo... i found the working repo requested node but I can't find how to download it manually and start the installation from there, thanks for Your help, I'm using Windows x64.
As their documentation says:
If you see a 404 when trying to install node-sass, this indicates that your trying to install a version of node-sass that doesn't support your version of NodeJS, or uses an alternate V8 environment (Meteor, Electron, etc...) that isn't supported by node-sass.
If you encounter this, please check what version of NodeJs you're running (node -v) and check for a supported version of node-sass for your NodeJs by checking our release page.

nodejs 4.2.6 not getting updated to latest version

I installed Node and npm as they are required to install angular cli.
Now, if I type this command:
npm install -g angular-cli
I get this message in terminal:
ERROR: npm is known not to run on Node.js v4.2.6 Node.js 4 is supported but the specific version you're running has a bug known to break npm. Please update to at least 4.7.0 to use this version of npm. You can find the latest release of Node.js at https://nodejs.org/
I also followed this link, but still the issue is not resolved.
I tried removing node, npm and then reinstalling, updating node according to all the ways I found on internet, but still the version(4.2.6) is same.
I don't understand what I am doing wrong as I am new to Linux.
Surprisingly, npm is quite complicated in Linux, until you discover Node Version Manager which allows you to easily install new versions and swap between them.
After installing nvm, you can install any node version with nvm install <VERSION_NUMBER> and you can set it as default with nvm alias default <VERSION_NUMBER>
You can swap between versions using nvm use <VERSION_NUMBER>

Node.js error : failed to initialize context

I just installed Node.js from Visual Studio installation.
When I tried to call node on the command prompt, I got this error. I also got this when I tried to do npm init and npm install
How do I fix this?
I encountered this problem on my Windows 10 64-bit computer. From looking at Programs and Features, I saw that I had Node.js and Node.js Chakra installed. I uninstalled Node.js and then downloaded and installed again it from https://nodejs.org/en/download/.
This, however, did not fix the problem. So I uninstalled Node.js Chakra; and when I opened a new command prompt, node and npm were working.
However, I'm not sure if I needed to uninstall and reinstall Node.js or if I only needed to uninstall Chakra. I probably should have uninstalled Chakra first and node and npm might have worked after that.

Resources