How to install older version of nodejs via n? - node.js

I've newly set up an environment, and installed nodejs from github, 0.11.14-pre. npm as well, 1.4.9. So, the problem is that my entire code base is on node#0.6.9. Upgrade isn't my option because it's too much work for it. I tried sudo n 0.6.9. It gives me Error : invalid version 0.6.9. Also I tried sudo n 0.10.28, and worked perfectly.
Is there any way to install node#0.6.9 manually or via n?
EDIT
nvm worked great for me, though it took me hours to install and run nvm. Also - I had a problem to have nvm install nodejs as a normal user due to a permission denial of creating a folder. But nvm-global solved my problems and was easy to install.
https://github.com/xtuple/nvm

Haven't tested this yet.. but this Node Version Manager looks really promising
Github: Node Version Manager

Related

LESS instalation - node file does not exist on Linux

I'm trying to install LESS css in Netbeans, but I'm running into one problem after another. As such, I already have LESS installed, but I can't get it running.
Less is installed via the npm package, I installed it using the packaging system, less itself via Terminal. The first problem I had was that despite a successful installation, Netbeans didn't get to the files he needed (usr/local/), I could either change permissions there, which I don't want to dig into, or change the location. So I changed the location of the .npm and .npm-global folders to my root (home/ivet/), from where Netbeans managed to load it.
So I set everything there, the general settings and the specific project and it looked fine.
I want it to be converted to css automatically after saving, but it throws the message "/usr/bin/env:"node": Directory or file does not exist" and the target css file is still empty.
I found a few advices, basically the same: "ln -s /usr/bin/node/ usr/local/bin/nodejs", but it tells me that the link already exists and nothing will solve it. On closer inspection, I found that the link does exist, but the target file does not exist.
I've also found that installing Nodejs legacy solves this, but this is an older piece of advice, the package no longer exists, and terminal pretends to have the packages that replace this installed. Even when searching for via grep, I couldn't find the file it should link to (neither node nor nodejs).
There are the same tips everywhere that don't work for me and I don't know what to try next. I use Linux Mint 20, but I call myself a Linux BFU, so please write answer step by step :-D
Thanks for the advice
Try completely removing NodeJS & npm and try to install NodeJS using nvm i.e., node version manager.
You can follow this link on how to install nodejs and npm using nvm.
It's always a tedious task sometimes when it comes to package managment with npm, so it's better to go with nvm and I strongly suggest to always have a fallback option for node version when using with or without nvm i.e.,
NodeJS LTS version & NodeJS latest/stable version.
There's also an alternative solution i.e.,you can try switching to yarn package manager.
I've had this issue on Ubuntu and I've resolved it likes this:
First of all I've removed node and npm packages via
sudo aptitude remove node npm
Then I've added the official repositories
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
After which I've just updated the list of packages with sudo aptitude update and then installed Node
sudo aptitude install nodejs npm
And that was it. With these steps done, everything just started to work.

How Can Knex (or Any NPM Package) Run a Different Version of Node?

I'm trying to use Knex's seed:run command (ie. npx knex seed:run), and inside my seed file I've added this line, which logs the version of Node that it's being run with:
console.log(process.version);
Now, if I run that exact same line of code in the Node command prompt itself (node), I get:
v14.2.0
Similarly, when I run node --version it correctly returns v14.2.0.
However, when Knex runs my seed file, I instead see:
v11.15.0
Can anyone explain how/why Knex is using a different version of Node, and how I can make it stop?
P.S. I've tried wiping my node_modules folder out and re-installing via npm i, but Knex continues to use an old Node somehow. Knex itself is installed at the latest version (0.21.1).
This may happen if you have a global installation that runs in privileged account (root), and a local installation to current user.
It is possible you are using some node versioning tool to manage nodejs versions, it creates a symbolic link to a managed version of node that overrides the default configuration. There are many tools that does that like nvm, n.
Danizavtz's answer didn't solve thigns for me, but it did point me in the right direction. I realized that I did have two versions of Node: one installed by Linux (using apt-get), and one I'd installed myself (to get a newer version of Node).
The solution for me was to remove the system version of Node with:
sudo apt-get remove node
That left me with a working Node ... but it removed my npm. I guess I could have just re-installed everything, but since I already had node and just needed npm, I downloaded the latest Node installation and used the node in it to install npm. I did this both with and without sudo (I'm not sure if doing it without sudo was even necessary, as it didn't fix things):
sudo ~/node-v14.3.0-linux-x64/bin/node ~/node-v14.3.0-linux-x64/bin/npm i -g npm
After that I finally got the expected Node version when I ran npx/npm!

Cannot install node.js under Windows 7: "the specified path is too long"

Using the newest node.js installer from https://nodejs.org, I run into the same error every time when it reaches the npm installation. npm 3.x was supposed to deal with this issue, but apparently it doesn't help the node.js installer. The node developers have essentially refused to do anything about it, as this problem has been around for about two years already. Unfortunately, I can't seem to find a work around. How can I get this to install?
I also had this error, trying to install node-v8.10.0-x64.msi on Windows 10.
My solution (to getting it to install; no idea if it won't break further down the line) was changing the install directory from C:/Program Files/nodejs to C:/njs/ (2nd step of current setup process).
I'm surprised those characters made the difference, and that there even is a Windows node release if there's not a proper solution to this (can't believe that maximum path length on Windows isn't modifiable), but this has seemingly worked for me.
I don't think its an installer error, actually windows is restricting the path size to be 150 char.
try reducing the file path name by copying it into direct c or d drive.
Check the link below Microsoft Forum
I've used Choco
It works together with NVM 4 Win.
After once installing node with choco install nodejs
then I install other versions of node using NVM e.g. nvm install 6.9.0
following by choosing that version with nvm use 6.9.0
and then verify with nvm list
and node -v.
I also need to install the latest version installed by choco using nvm install 10.1.0

Can't update from Node v0.10.46 on Mac

I'm having problem's when trying to run my gulp command in the terminal. I've been trying to track down the issue and from what I can tell the issue is that I'm running an outdated version of node.
node -v tells me that I am on v0.10.46, but the Node install downloaded from the website says it's currently on v4.4.7.
The first issue I had was with es6 promises, but I managed to install the es6-polyfill which solved the issue.
Now gulp is throwing an error related to /node_modules/gulp-imagemin/index.js. Specifically the use of const variables. (const path = require('path')).
Based on this thread: https://github.com/sindresorhus/gulp-imagemin/issues/181#issuecomment-219303510 - this issue seems to be an outdated version of node, but no matter what I do it won't upgrade!
I've explored all possible avenues for upgrading Node - using npm, nvm, n, brew and even a local re-install, but everytime it seems to be installing an outdated version.
I've explored the possibility that I'm installing a 32bit version on a 64bit system, but that doesn't seem to be the issue either.
I have absolutely no idea how to progress fixing this issue. I'm trying to build a wordpress website, and no matter what theme I use this error comes back to haunt me!
Help!
EDIT:
Just to add.. in this image (http://imgur.com/a/OzR5Y) you can see the output of me trying to upgrade using N, and then following the David Walsh upgrading method.
I had the same problem and I tried everything from uninstalling it by this instructions without any result. But maybe you have in your computer a management like nvm installed, just try this:
which node
And then if the respond of that is something like:
/Users/MYUSER/.nvm/v0.10.46/bin/node
That's the problem, so you can solve this by uninstalling nvm and then install Node.js normally or just keep using nvm

Installing an old version of Node.js on a Vagrant VM

I'm setting up a Vagrant environment for a client with some legacy dependencies that require Node.js v0.4.12. I know I can install it via nvm, but that's provisioning the box with NVM and starting the node app is proving...problematic. In a perfect world, I'd be able to install old versions via apt (apt-get install nodejs=0.4.12), but that doesn't seem to be an option. I can't find a single PPA that retains old versions.
I know I can pull and compile from source (that's where I'll go if I have to), but I'm wondering whether there are any other options I just haven't found. I also need npm.
For whatever it's worth, I ended up installing with nvm. There are still some minor issues to resolve like existing the provision script cleanly, but Node gets installed and started successfully so I guess that's the answer. At least for now.

Resources