Can't upgrade beyond node version 0.10.35 - javascript

I recently got an email from MongoDB to update my drivers to be compatible with the new MongoDB 3.0
I am trying to up my Node.js to version "1.4.29". Currently I am the running the node version "0.10.35".
How can I upgrade node.js driver via NPM to 1.4.29 to be compatible with MongoDB 3.0?
I have tried the following:
npm install g -n
I also tried this:
It just won't install any version higher then 0.10.35, Its stuck at the version. In the image above you can see it starts of my install node version 4.0 but ends up with 0.10.35 which I already have.
Which I was told would get the latest version of node but that did not seem to work.
Thanks in advance.

First you need to clean the cache and then start the up gradation process. Use the below commands in the NodeJS command window to upgrade to latest version.
npm cache clean
npm update -g
If you desire to install specific version of node then use the command sudo n 0.12.2
Reference taken from How to upgrade Node.js via NPM

The way to install the new versions of node with n is to use this command n <version>. For example use n 5.1.0 for the latest version of nodejs.

Related

Node version v17.3.0, but environment set up for node 12.18.2. How change environment to 17.3.0?

I updated node to v17.3.0. When I type in cmd ----> node -v. I have version v17.3.0. I am trying to install react-create-app and can't. I have the message Your environment has been set up for using Node.js 12.18.2 (x64) and npm. How to solve this problem?
I suggest installing and using nvm - https://github.com/nvm-sh/nvm
Once you install it, you can do nvm install 17.3.0 and then nvm use 17.3.0
This script makes it really easy to switch between node & npm versions.

Downgrade Node on MacBook

I installed the latest version of Node on their website, but I had issues with png and segmentation errors and such, looked it up and saw that it is a common issue on version 16. So I decided to downgrade to the stable version (14), which I have been unable to do. I've tried
npm install -g node#14.17.1
After running this and doing node -v, it still shows the latest version (16). How can I uninstall version 16 and only be on the stable version (14)?
The best way is to use nvm Here, you can get brief details on how to use nvm. nvm is a version manager for node.js, designed to be installed per-user, and invoked per-shell. nvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: Unix, macOS, and windows WSL.
The best thing is, you can run multiple versions of node at the same time on a different shell, It's like version manager on steroids. Please check this also n package.
Find out where is the current node and delete
where node
Install nvm
For macOS
Show all the versions
nvm ls available
Install what you want
nvm install 14.17.1
nvm use 14.17.1
Check node version
node -v

Create React App with an older version of node

I am trying to use Create React App but getting an error that it requires Node 10 or higher. My node version is Node 8.10.0 and there's no way for me to update the Node version since it's a work machine. Is there any way to run an older version of Create React App to work with my older Node version?
I managed to run it. It seems like the last versions of the packages which support Node 8.x.x are 3.4.1 for create-react-app and 3.1.1 for react-scripts. What I did:
npm uninstall -g create-react-app
npm install -g create-react-app#3.4.1
create-react-app my-app --scripts-version 3.1.1
But it's better to update your Node version to the actual (or LTS at least).
From my understanding you can add the flag --scripts-version to your npx create-react-app command. So for example if you wanted to run react version 15.6 you would run something like:
npx create-react-app appname --scripts-version 1.0.14
You can reference the react-script repo as well as the NPM Package for more information on which version of the script you would want to run. Hopefully this helped! If not please let me know and I'm more than willing to try and look more into it.
Edit:
Forgot to mention that you need to make sure to change the versions of react and react dom within your package.json after. So after installing you would run:
npm i react#15.6
npm i react-dom#15.6

node 8.4.0 already installed - But node -v shows v7.7.4

I tried to upgrade my Node version, I downloaded the file from their website, run through the installation and everything seemed OK.
When I tried to check if the latest version has been installed, node -v showed me v7.7.4 instead of v8.4.0.
I tried brew upgrade node but it told me node 8.4.0 is already installed.
How do I switch to the latest version?
Thanks!
You're using nvm to install multiple versions of Node.js, and it looks like you set 7.7.4 as the default version of Node that nvm should use, which means that even though the system-wide version of Node is 8.4.0, nvm will insert the path to the 7.7.4 executable earlier in $PATH.
You can change the default to point to the system-wide version:
nvm alias default system
FWIW, Homebrew (brew) is yet another method of installing Node. However, given the amount of issues I see being posted here on StackOverflow related to that particular install, I wouldn't advise using it. Use the official installer to install the system-wide Node, and use nvm to manage different versions (for instance, to test your code with).
you can check your installation directory
Command : 'where node '

Node installed but node cannot be found in Ubuntu VPS

I installed node via NVM. I installed node 0.10.32. using NVM 0.25.0
When I do node -v I get
-bash: /root/.nvm/v0.10.32/bin/node: No such file or directory
when I do npm v I get
/root/.nvm/v0.10.32/bin/npm: 2: exec: /root/.nvm/v0.10.32/bin/node: not found
All those directories exist and node executable is in it but they are reading as not found. Node seems to be installed but I am unable to use it. I am not sure how to fix this issue. Any ideas will be greatly appreciated
Check that your ~/.bash_profile has this:
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
https://github.com/creationix/nvm/issues/576
A lot of things can be wrong here from what you describe. Generally I don't recommend using nvm to install Node on servers. It works fine for your own work on a local machine but when you need to be sure what is installed and where, I recommend doing a real installation.
I recently wrote a tutorial on how to install Node on Linux:
https://gist.github.com/rsp/edf756a05b10f25ee305cc98a161876a
It is specifically about version 6.7.0 but just change the version number to use any other version of Node.
You can see other answers showing how to install Node properly and troubleshoot if it isn't installed correctly:
Run npm as superuser, it isn't a good idea?
node 5.5.0 already installed but node -v fetches with "v4.2.1" on OS X & homebrew?
Just get the binary or source package of the version that you need, install it where you want and it will work. The most reliable way is to install a source package because you can run make test before you install and because npm will have the correct shebang line (which may not always be the case with binary distribution - which, incidentally, is also used by nvm). No need to use nvm or any other tool to do that.
The nvm is great if you need to quickly switch Node versions during development on your local machine but if you want a reliable way to install Node on the server then it's best to install it normally.

Categories

Resources