Downgrade NodeJs Version and express version - javascript

Currently I am working on a nodejs project. I have installed Express 3.X which is in alpha stage, and my node version is also at 0.7.2-pre. I am currently trying to downgrade my express version, via npm, but it seems that i have to downgrade my node version as well.
What is the best way to achieve this? How do i down grade my node version. Thank you very much.

To easy the node version management you can use an npm package called n

There are tools that allow you to have multiple versions of Node installed - e.g. NVM - so you could do that.
However, to answer the question, you will need to re-install Node I'm afraid. Thankfully installing from source is pretty easy though a little slow. Just follow the installation instructions on the GitHub page.

Related

Error when Installing dependencies on a React project (node)

Hello I am currently stuck with a task that is given to me. The problem is that I am unable to install dependencies when running npm install which means that I am unable to run the website locally which is my main goal
There are many versions of this question in the internet but I am not really sure what the main cause of this therefore the title of this question
you can view my error logs here
https://www.codepile.net/pile/4qL4NOq0
I have also tried some solutions that I have seen on the internet such as:
reinstalling node
deleting node_modules and package-lock.json and re-npm install (this is when I have installed the node_modules but still unable to run the website locally)
installing grpc globally
The version of grpc that you are installing (1.23.3) does not support the version of Node.js that you are using (16). You will need to use a newer version of grpc (the latest is 1.24.11) or an older version of Node to get that to work.
Please note that the grpc package has been deprecated in favor of the #grpc/grpc-js package. It is recommended that you use that one instead if possible.

Terminal stops running commands after switching Node's version with nvm

Hope to find you guys well =).
So, my problem is that I'm trying to initialize a Gatsby project and after some trouble I discovered that for some boiler plate "starter" template to work I would have to install an older version of Node. Since I already have nvm installed, I just downloaded the version I wanted and switched via terminal.
I verified it with node -v and it threw me the version I wanted. The thing is that when I try to run 'gatsby develop' it says "gatsby: command not found".
And that if I close and open my terminal again it resets the version. Is this supposed to behave like that?
By the way, you can already tell that I'm new at this so any information or guidelines will be of extreme helpfulness.
You can try doing yarn develop if using yarn. Or npx develop if using npx

Installing Node js manually vs with package managers

I installed Node.js on Mac last year by just downloading it from nodejs.org. However, i have noticed that it is usually installed via some package managers like Homebrew(bad way) and NVM(good way). Question 1: Should i uninstall current Node.js and install it via NVM(which i don't even have)? Question 2: Is switching between Node version common? And why would someone do that?
Using NVM is a good idea indeed!!. There may be different projects that use different versions of NodeJs. In that situation, a library like NVM would be pretty helpful else you have to uninstall the old version and install the new one. You know how hard it is to uninstall and reinstall a new one each time you want to have a new version. Moreover if you want to try some new feature that is shipped in a newer version of Nodejs, you have to go through the installation/uninstallation process again.
So using NVM would create a sandbox like environment where one version on Node won't mess with another one.
Long story short, NVM would be helpful.After you install NVM, it's just a matter of doing NVM install 'nodeversion' and NVM use 'nodeversion' to use a particular version of Node.
Chances are you could be working on different projects which are based on different versions of node. nvm could help in this case.
It’s also very helpful if you want to verify whether your application works on different versions of node or not.
In general it’s nothing different with python2/3, different version of JDK, etc. You can stick with your current installation and switch to nvm only if it’s necessary. You will know when you need it.

How to install latest STABLE version of a Javascript package via a package manager?

How to install latest stable version of a Javascript package via a package manager?
(no alphas, betas, etc.)
I tried NPM and did not find a solution. This question is similar.
I tried Bower and find nothing. Here is a question with no answer here.
Please help. Which package manager should I choose? Maybe there are another options around?
PS
For example: knockout.js, npm givers beta for latest. I don't want beta! I also would like to set the same limitation for dependencies - pull only stable versions.
Installing a package without specifying a version will always install the latest version published to npm, including pre-releases (alpha, beta etc.):
npm install knockout
However, if you specify the version range, even only as a wildcard *, pre-release versions are explicitly excluded:
npm install knockout#*
See the npm docs for more info. Also, you can test this in npm's semver calculator.

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