I moved from windows to ubuntu and following the instruction as per the site - https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
Following comand ran successfully
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
Then
sudo apt-get install -y nodejs
The output of the above command is :
$sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version (4.2.6~dfsg-1ubuntu4.1).
0 upgraded, 0 newly installed, 0 to remove and 519 not upgraded.
As you can see its taking nodejs of version 4 , although I trying to install 8+
I removed the nodejs with
sudo apt-get remove nodejs
but still on trying again it says the same thing.
Please note that the setup is new and there was nothing installed previously
I am not sure but I wanted 'node', why its trying to install nodejs
If I try to do this -
$ sudo apt-get install node
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package node is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'node' has no installation candidate
Hey I use Ubuntu 16 the latest LTS
What you can do, is install ubuntu-make
Then run
umake nodejs
It installs the latest version available (v8.2.1)
Or, you can also use nvm
The detailed instructions are here
Note If you use ubuntu-make , you may have to log out and log in
Then check your version via node -v
Once you have version 4, you can update it to the latest. See this topic Upgrading Node.js to latest version
Related
im trying to install NodeJS LTS on my vm. But ubuntu (22.04) throws an error
Error:
root#web-server ~/server# sudo apt list nodejs
Listing... Done
nodejs/unknown 18.12.0-deb-1nodesource1 arm64
N: There is 1 additional version. Please use the '-a' switch to see it
root#web-server ~/server# sudo apt install nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
javascript-common libc-ares2 libjs-highlight.js libnode72
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 93 not upgraded.
Need to get 0 B/27.8 MB of archives.
After this operation, 180 MB of additional disk space will be used.
(Reading database ... 83553 files and directories currently installed.)
Preparing to unpack .../nodejs_18.12.0-deb-1nodesource1_arm64.deb ...
Unpacking nodejs (18.12.0-deb-1nodesource1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_18.12.0-deb-1nodesource1_arm64.deb (--unpack):
trying to overwrite '/usr/share/systemtap/tapset/node.stp', which is also in package libnode72:arm64 12.22.9~dfsg-1ubuntu3
Errors were encountered while processing:
/var/cache/apt/archives/nodejs_18.12.0-deb-1nodesource1_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root#web-server ~/server [100]#
I tried to delete and install it again multiple times bu nothing happens
Follow this link: Github Error solved link
and reinstall nodejs with the following command as given below
Installed Nodejs version-12.22.9 Successfully on my Ubuntu 22.04
sudo apt update
sudo apt install nodejs
Press Y when prompted to confirm installation. If you are prompted to restart any services, press ENTER to accept the defaults and continue. Check that the install was successful by querying node for its version number:
node -v
Output
v 12.22.9
Try this:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
$ source ~/.bashrc
$ nvm list-remote
$ nvm install v16.14.0
$ nvm install lts/fermium
$ node -v
These steps will install nodejs v14.19.0.
There is a very helpful link to setup or update nodejs on Ubuntu 22.4
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-22-04
you can visit it for more details.
i was going to start use reactjs when but i had this :
create-react-app myapp
You are running Node 9.11.2.
Create React App requires Node 14 or higher.
Please update your version of Node.
i tried to update my node js by runing :
sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version (8.10.0~dfsg-2ubuntu0.4).
The following package was automatically installed and is no longer required:
libllvm6.0
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
My pc is 32 bit extensa 5635z
my os is lubuntu
any help please ?
To install the desired version of nodejs you can use the NodeSource Node.js Binary Distributions.
For Node.js v17.x:
# Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -
sudo apt-get install -y nodejs
installed node.js already but shows
Command nodejs not found, but can be installed with:
sudo apt install nodejs
then tried, sudo apt install nodejs
and shows
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version (14.13.1-deb-1nodesource1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
but when I try to check node.js version, $ nodejs -v
it shows, Command nodejs not found, but can be installed with:
sudo apt install nodejs
Please help me to solve this error and properly see node.js version
The nodejs executable is called node, please run node --version to see if your installation works.
I have this odd problem that when I try to install NodeJS on a fresh Ubuntu Server VM.
I execute the two simple steps from the official instruction but somehow I manage to fail.
In the home directory of my user I execute curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - which ends successfully and then sudo apt-get install -y nodejs but this results in the installation of v.4.2.6.
Output can be seen below:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/3161 kB of archives.
After this operation, 13,2 MB of additional disk space will be used.
Selecting previously unselected package nodejs.
(Reading database ... 97187 files and directories currently installed.)
Preparing to unpack .../nodejs_4.2.6~dfsg-1ubuntu4.1_amd64.deb ...
Unpacking nodejs (4.2.6~dfsg-1ubuntu4.1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up nodejs (4.2.6~dfsg-1ubuntu4.1) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Please help.
You probably have to run sudo apt-get update before sudo apt-get install to update the local package lists after adding the sources for 6.x. If you do that, you should see version 6 being installed.
The answer was hiding in this thread: Installing NodeJS on Ubuntu Trusty
So it must have been some kind of an issue with curl using the local network so I used wget to download like this:
wget https://deb.nodesource.com/setup_6.x
And then from the same directory:
sudo bash ./setup_6.x
And finally:
sudo apt-get install nodejs
Which did it.
You might consider using nvm to install Node instead of the distro package. This offers you more flexibility in managing your version of Node.
I have come across ReactJS and React Native. ReactJS is brilliant, super fast and works fine on Node v0.10. But, React Native needs v4.x as a prerequisite.
So, when I run any react-native command, it fails and says Node 4 is required.
I have tried several times and many ways to update Node, but, have failed.
First followed Installation Instructions -
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash
sudo apt-get install -y nodejs
I ended up with the following message-
root#purvotara:/# apt-get install -y nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Then, there was Manual Installation way of installing.
add-apt-repository -y -r ppa:chris-lea/node.js
rm -f /etc/apt/sources.list.d/chris-lea-node_js-*.list
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
echo 'deb https://deb.nodesource.com/node/dists/trusty/Release main' > /etc/apt/sources.list.d/nodesource.list
echo 'deb-src https://deb.nodesource.com/node/dists/trusty/Release main' > /etc/apt/sources.list.d/nodesource.list
apt-get update
apt-get install nodejs
Still, ended up with -
nodejs is already the newest version.
I tried to purge and auto-remove my current v0.10 node and tried to freshly install, not sure if its still picking the install from the cache, but, v0.10 got installed.
Also followed linoxide article on the same. A .configure and make install didn't seem to work as well.
What am I doing wrong? I am stuck for hours.
Went over several other links to resolve other issues(they are resolved now)-
Uninstalling node
Failed to fetch Trusty
Use n. npm install -g n
then you can switch to any version of node using a command like this n v4.1.2
https://www.npmjs.com/package/n
n uses /usr/local/bin/node for n to work properly on debian based systems, create a symlink to point to this directory.
sudo ln -s /usr/local/bin/node /usr/bin/node
#Holger This was the result of using 'n'.
I have added this as an answer, as I want to bring more clarity in the code and solution itself.
Still facing the same problem.
I installed 4.2.1, but, v0.10 is being shown.
root#purvotara:/# n 4.2.1
install : node-v4.2.1
mkdir : /usr/local/n/versions/node/4.2.1
fetch : https://nodejs.org/dist/v4.2.1/node-v4.2.1-linux-x64.tar.gz
installed : v4.2.1
root#purvotara:/# n
root#purvotara:/# node -v
v0.10.25
I used NVM and the issue is solved.
You can Do it Two ways. First try second step It must work for you.
1 Uninstall First version and Reinstall Other one 4.1.2 is latest as per my knowledge.
2 Click Here Follow steps.
sudo apt-get update
sudo apt-get install build-essential libssl-dev
curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh
source ~/.profile
nvm ls-remote
nvm install 4.*.* // Latest version choose here
nvm use 4.*.* // Latest version also here
node -v // Check your version