I installed Node-12 from source but can't get nodejs --version - node.js

I have a problem after installing node in Ubuntu 16. I installed node-12 from node-v12.13.1-linux-x64.tar.xz but I can't get nodejs --version to execute.
The program 'nodejs' is currently not installed. You can install it by typing
sudo apt install nodejs
What should I do ?

you can do node -v , nodejs is not the name of the executable

Related

Cannot install node version 8.11.2 into my ubuntu machine

I need to install nodejs version8.11.2 into my ubuntu machine. my ubuntu versions is 18.04.
In my machine installed node version is 10.0. Although I use 'sudo apt-get remove nodejs' command to uninstall nodeJS, it is not removing. When i run node -v, it gives the same version.enter image description here
enter image description here
Install Node.js from the NodeSource repository
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
The command above :
Adds the NodeSource signing key to your system.
Creates an apt sources repository file.
Installs all necessary packages.
Refreshes the apt cache.
Then you can do : sudo apt install nodejs
At the time of writing this 12.4.2 is the current latest Node.js version.
You can install version 10.16.0 by changing setup_12.x to setup_10.x in the first command.

Installing latest version of npm on Ubuntu 14.04 (trusty)

I have
a remote serving running Ubuntu 14.04. I used apt to install node
a local OSx machine running El Capitan. I used hombrew to install node.
This results in the following.
Ubuntu 14.04
> sudo apt-get update
> sudo apt-get install node nodejs npm
> npm --version
1.3.10
> node --version
(emtpy)
> nodejs --version
v0.10.25
OSx
> brew install node
> npm --version
5.6.0
> nodejs --version
-bash: nodejs: command not found
> node --version
v8.11.3
Why are the apt repositories so out of date? The npm version on the server (1.3.10) is 4 versions behind that of OSx machin (5.6.0).
This npm issue even mentions that the apt repositories are quite old / not updated.
Is there a way to install a more recent version of npm on the Ubuntu server?
Download this tar file from nodejs official website
https://nodejs.org/dist/v8.11.4/node-v8.11.4.tar.gz
download, untar and install it via using the following command
sudo make test
sudo make install
It will install 8.11.4 version.
Please note that you can download any version of tar from nodejs officail page and can install it on your Ubuntu server and by using this method you don't need to update your apt packages.

Node Server Unable to Start

Issue: Unable to start Node server
Platform: Bash on Ubuntu on Windows 10
Currently following tutorial that builds a blog on MEAN
Commands ran after installation:
apt-get install npm
npm init
npm install express --save
node server.js
Last command node server.js supposed to start Node server.
But nothing happens on my bash command line.
server.js codes:
command node-v (node version not found):
However, Node is already installed:
Accessing localhost:3000
On Ubuntu (and Debian as well), the correct package to install for Node.js is called nodejs:
$ sudo apt-get install nodejs
However, my experience is that this generally installs an outdated version of Node, which isn't great. It also installs the interpreter with the executable name nodejs, not node as you would expect.
Alternatively, you can add the official binary distribution repositories for Node.js, which allows you to install more recent versions of Node (v6 or even v7). These are also kept up-to-date much better than the Ubuntu/Debian repositories.
The process is documented here, but if you want to install Node v6, you would run this code:
$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
$ sudo apt-get install -y nodejs
It's probably best to remove any previously installed packages (npm, node, nodejs) before running the commands above.

can't check node version by installing via node version manager

I am trying to install nodejs via NVM. I use the tutorial here (https://github.com/creationix/nvm). After running nvm install v0.10.25, I try to check current node version by running node -v, but it says The program 'nodejs' is currently not installed. You can install it by typing:
apt-get install nodejs. What's wrong with this?

How to install nodejs 0.12.7

I've trying to install the latest version of nodejs
sudo apt-get nodejs
installs the version 0.12.25
When I downloaded the tar.gz from https://nodejs.org/ and installed
my node version upgraded to 0.12.7 but not nodejs version.
And when I tried like this
sudo apt-get install nodejs=0.12.7
E: Version '0.12.7' for 'nodejs' was not found
This error popped up. What can I do such that on entering
nodejs -v
I can get 0.12.7
Since there are a lot of Node.js versions, and there is also iojs, I suggest you to use a straightforward Node.js version manager, like the very good n.
So, first install n, then install Node.js 0.12.7 with:
$ n 0.12.7
When you install node.js from source by default it will install with node as name of the executable
node -v
Will show 0.12.7
If you need node.js for development purposes on your machine you can use nvm, it allows to install different versions of node.js and io.js, and easily switch between them
Remove node with command sudo apt-get remove node, then remove nodejs using sudo apt-get remove nodejs. After that try to install nodejs again with version you need sudo apt-get install nodejs=0.12.7.

Resources