Upgrading to Nodejs 8 and "error: failed to commit transaction" - node.js

I am trying to upgrade my nodejs 6 to 8 in my arch linux. So I did:
$ sudo pacman -S nodejs npm
Result:
resolving dependencies...
looking for conflicting packages...
Packages (3) openssl-1.0-1.0.2.l-1 nodejs-8.1.3-1 npm-4.6.1-1
Total Installed Size: 39.22 MiB
Net Upgrade Size: 6.79 MiB
:: Proceed with installation? [Y/n] y
(3/3) checking keys in keyring [####################################################################] 100%
(3/3) checking package integrity [####################################################################] 100%
(3/3) loading package files [####################################################################] 100%
(3/3) checking for file conflicts [####################################################################] 100%
error: failed to commit transaction (conflicting files)
openssl-1.0: /usr/lib/libcrypto.so.1.0.0 exists in filesystem
openssl-1.0: /usr/lib/libssl.so.1.0.0 exists in filesystem
Errors occurred, no packages were upgraded.
And now my nodejs is broken I think!
$ node --version
node: error while loading shared libraries: libhttp_parser.so.2.7.1: cannot open shared object file: No such file or directory
Any ideas what should I do now?

I had same problem and this is how I solve it :
sudo pacman -S nodejs npm --force
Option --force will upgrade your package even if you get warning with existing files.
After this you need to install http-parser with pacman so :
sudo pacman -S http-parser --force
Finally, node -v will give you this error :
error while loading shared libraries: libicui18n.so.59: cannot open shared object file: No such file or directory
To fix it, install icu lib from pacman :
sudo pacman -S icu --force
Here we go, your node version is now v8.4.0.
Edited 17/01: --force was deprecated. Please use --overwrite

Related

can't install node/npm with either nvm or apt get install (wsl2 ubuntu)

I can't install node/npm with either nvm or apt get install (wsl2 ubuntu). Here is what I tried first
$ code export NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist
$ curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
It installed nvm but when I did nvm ls I only got this (no versions listed)
-> system
iojs -> N/A (default)
node -> stable (-> N/A) (default)
unstable -> N/A (default)
So I did ~/.nvm and tried apt-get install -y nodejs which seemed to work ...
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
npm
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded.
Need to get 0 B/122 kB of archives.
After this operation, 932 kB of additional disk space will be used.
Selecting previously unselected package nodejs.
(Reading database ... 40014 files and directories currently installed.)
Preparing to unpack .../nodejs_12.22.9~dfsg-1ubuntu3_amd64.deb ...
Unpacking nodejs (12.22.9~dfsg-1ubuntu3) ...
Setting up nodejs (12.22.9~dfsg-1ubuntu3) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Processing triggers for man-db (2.10.2-1) ...
Scanning processes...
Scanning candidates...
Scanning processor microcode...
Scanning linux images...
Failed to retrieve available kernel versions.
Failed to check for processor microcode upgrades.
No services need to be restarted.
No containers need to be restarted.
User sessions running outdated binaries:
root # /dev/pts/0: bash[9754,9845], sh[10875]
root # /dev/tty1: init[9752], wsltermd[9753]
root # /dev/tty2: bash[25], init[24]
No VM guests are running outdated hypervisor (qemu) binaries on this host.
Then I did node -v ...
bash: /usr/bin/node: cannot execute binary file: Exec format error
I am running on a brand new windows machine with win10 home. I installed wsl2/ubuntu-22.04 and have been using it with no problem. So everything is fresh. I am not behind any proxy.
I am pulling my hair out. Can someone help me?
EDIT: I did apt install nodejs npm from a vscode wsl terminal and got a very long install which seemed successful. Now when I run npm i -g vite I get ...
/usr/bin/node: 1: ELF: not found
/usr/bin/node: 2: : not found
/usr/bin/node: 4: Syntax error: Unterminated quoted string
so I'm losing even more hair. By the way, I've been following The IT Crowd advice and rebooting often.
I got node/npm installed by reverting to ubuntu 18.04, installing nvm, and doing nvm install 'lts/*'.
nvm ls still doesn't give any results so I'm surprised the install worked. It's also a pain that I can't list the node versions.

Unable to install flatpak on Arch Linux

[Trying to] Installing flatpak on Arch linux fails:
$ sudo pacman -S flatpak
resolving dependencies...
:: There are 3 providers available for xdg-desktop-portal-impl:
:: Repository extra
1) xdg-desktop-portal-gtk 2) xdg-desktop-portal-kde
:: Repository community
3) xdg-desktop-portal-wlr
Enter a number (default=1): 1
looking for conflicting packages...
Packages (11) appstream-glib-0.7.18-1 gcab-1.4-1 geoclue-2.5.7-3 geocode-glib-3.26.2-1
gnome-desktop-1:40.0-1 gnome-keyring-1:40.0-1 libstemmer-0+713-2 ostree-2021.1-1
xdg-desktop-portal-1.8.0-1 xdg-desktop-portal-gtk-1.8.0-1 flatpak-1.10.2-1
Total Download Size: 0.63 MiB
Total Installed Size: 29.29 MiB
:: Proceed with installation? [Y/n] Y
:: Retrieving packages...
error: failed retrieving file 'ostree-2021.1-1-x86_64.pkg.tar.zst' from mirror.rackspace.com : The requested URL returned error: 404
error: failed retrieving file 'ostree-2021.1-1-x86_64.pkg.tar.zst' from mirrors.evowise.com : The requested URL returned error: 404
error: failed retrieving file 'ostree-2021.1-1-x86_64.pkg.tar.zst' from mirror.rackspace.com : The requested URL returned error: 404
error: failed retrieving file 'ostree-2021.1-1-x86_64.pkg.tar.zst' from mirror.rackspace.com : The requested URL returned error: 404
warning: failed to retrieve some files
error: failed to commit transaction (failed to retrieve some files)
Errors occurred, no packages were upgraded.
What's the correct way to download and install flatpack on Linux?
Update the system with
pacman -Syu and try again
buy I highly recommend going with AUR packages
Note that it is not advisable to install an individual package after -Sy or -Syy. If you need to update your mirrors with -y to install a package, you should combine it with a full system upgrade -u:
sudo pacman -Syu flatpak
You might not see immediate breakage with -Sy <package>, but eventually something will break with continued use. If <package> happens to pull in new lib versions, then any program that depends on those libs will break since they will still be built against the old libs.
Solved it with running sudo pacman -Syy first
This is sometimes happen. you can solve it using pacman -Syu flatpak.
If it didn't solve then you have to change your repository server either from /etc/pacman or /etc/pacman.d/mirrorlist.

Can't Install Node 12.8

I have been trying to install node.js on my Mac to use React Native. I tried many different times to install and reinstall node but I'd get a lot of errors.
I have tried installing on a fresh hard drive and I still can't seem to get it to work.
What I would try:
bash-3.2$ brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-12.8.0.mojave.bottle.t
Already downloaded: /Users/malqadi/Library/Caches/Homebrew/downloads/8ea6192c6101b64b58b3ff8bf0cab0b89eb67851ec11f5c95edda2fffcbdbfb0--node-12.8.0.mojave.bottle.tar.gz
==> Pouring node-12.8.0.mojave.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/systemtap/tapset/node.stp
Target /usr/local/share/systemtap/tapset/node.stp
already exists. You may want to remove it:
rm '/usr/local/share/systemtap/tapset/node.stp'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
Possible conflicting files are:
/usr/local/share/systemtap/tapset/node.stp
/usr/local/lib/dtrace/node.d
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall node`
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> Summary
🍺 /usr/local/Cellar/node/12.8.0: 4,629 files, 53.1MB
I do what it recommends, but its the same:
bash-3.2$ brew postinstall node
==> Postinstalling node
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall node`
So I try brew doctor:
bash-3.2$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
node
How would I get this to work?
Try removing the npm module with this command:
rm '/usr/local/share/systemtap/tapset/node.stp'
before linking node with this command:
brew link node

Unable to install node.js v8 on CentOS 7

I tried following the instructions on nodesource by running these commands as root:
curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -
yum install -y nodejs
But when I run node -v afterward I can see that it only installed 0.10.48. I can see in the output of the second command that it's selecting the wrong version of the package for download:
Loaded plugins: fastestmirror, priorities
Setting up Install Process
Loading mirror speeds from cached hostfile
* epel: mirror.steadfast.net
* remi: repo1.sea.innoscale.net
* remi-safe: repo1.sea.innoscale.net
2418 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.48-3.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================================================================
Installing:
nodejs x86_64 0.10.48-3.el6 epel 2.1 M
Transaction Summary
=========================================================================================================================================================================================
Install 1 Package(s)
Total download size: 2.1 M
Installed size: 7.1 M
Downloading Packages:
nodejs-0.10.48-3.el6.x86_64.rpm | 2.1 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : nodejs-0.10.48-3.el6.x86_64 1/1
Verifying : nodejs-0.10.48-3.el6.x86_64 1/1
Installed:
nodejs.x86_64 0:0.10.48-3.el6
Complete!
I've tried uninstalling with yum remove -y nodejs npm and then running rm -fv /etc/yum.repos.d/nodesource*, yum clean all, yum update and then reinstalling but nothing seems to work.
Why doesn't it resolve to the v8 package?
I had the same problem few days ago and I was not able to install Node version 8 via the nodesource repository.
In fact, there is no setup_8.x script in the rpm repository yet.
I end up with n package to get Node version 8:
# yum install nodejs // you need to have npm installed
# npm install -g n
# n stable
# node -v // v8.4.0

Build Gem Native Extension

Passing on knowledge I just learned in the hopes of reducing the
headache others may experience with native gem extensions like I've
had.
TL;DR - Had an issue with bundle install. Read mkmf.log as mentioned in the error. The log had another error that I googled. Installed
necessary library. Afterwards, bundle install was successful.
Trying to install gems using bundler and getting errors about building gem native extensions:
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Installing daemons 1.2.3
Installing eventmachine 1.0.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/eventmachine-1.0.8/ext
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160309-8483-1so3k75.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
<...>
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/eventmachine-1.0.8/mkmf.log
extconf failed, exit code 1
<...>
Installing mysql2 0.4.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/mysql2-0.4.3/ext/mysql2
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160309-8483-1oxfnj5.rb extconf.rb
checking for ruby/thread.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
<...>
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.3/mkmf.log
extconf failed, exit code 1
<...>
Installing rack 1.6.4
Installing tilt 2.0.1
Using bundler 1.11.2
An error occurred while installing eventmachine (1.0.8), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.0.8'` succeeds before bundling.
Passing on knowledge I just learned in the hopes of reducing the
headache others may experience with native gem extensions like I've
had.
TL;DR - Had an issue with bundle install. Read mkmf.log as mentioned in the error. The log had another error that I googled. Installed
necessary library. Afterwards, bundle install was successful.
I see that the errors point me to mkmf.log and where it's located. I open it up and check the error. Among other things it mentions the following on lines 2 and 3.
/usr/bin/ld: cannot find -lgmp
collect2: error: ld returned 1 exit status
I know from the error while during bundle install that it could be missing a library. So I search for a package called gmp. I find 2 libraries, one called libgmp10 and the other libgmp10-dev.
$ apt-cache search -n gmp
libgmp-dev - Multiprecision arithmetic library developers tools
libgmp10 - Multiprecision arithmetic library
<...>
I search my installed packages to see if I need to get one.
$ dpkg --get-selections | grep gmp
libgmp10:amd64 install
Since libgmp10 is already there, I try installing libgmp-dev. Then I run retry installing my gems, and it works!
$ sudo apt-get install libgmp-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libgmpxx4ldbl
Suggested packages:
libgmp10-doc libmpfr-dev
The following NEW packages will be installed:
libgmp-dev libgmpxx4ldbl
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 300 kB of archives.
After this operation, 1,675 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main libgmpxx4ldbl amd64 2:5.1.3+dfsg-1ubuntu1 [8,736 B]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main libgmp-dev amd64 2:5.1.3+dfsg-1ubuntu1 [292 kB]
Fetched 300 kB in 0s (411 kB/s)
Selecting previously unselected package libgmpxx4ldbl:amd64.
(Reading database ... 218685 files and directories currently installed.)
Preparing to unpack .../libgmpxx4ldbl_2%3a5.1.3+dfsg-1ubuntu1_amd64.deb ...
Unpacking libgmpxx4ldbl:amd64 (2:5.1.3+dfsg-1ubuntu1) ...
Selecting previously unselected package libgmp-dev:amd64.
Preparing to unpack .../libgmp-dev_2%3a5.1.3+dfsg-1ubuntu1_amd64.deb ...
Unpacking libgmp-dev:amd64 (2:5.1.3+dfsg-1ubuntu1) ...
Setting up libgmpxx4ldbl:amd64 (2:5.1.3+dfsg-1ubuntu1) ...
Setting up libgmp-dev:amd64 (2:5.1.3+dfsg-1ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Using daemons 1.2.3
Installing eventmachine 1.0.8 with native extensions
Installing mysql2 0.4.3 with native extensions
Using rack 1.6.4
Using tilt 2.0.1
Using bundler 1.11.2
Installing rack-protection 1.5.3
Installing thin 1.6.4 with native extensions
Installing sinatra 1.4.6
Bundle complete! 3 Gemfile dependencies, 9 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

Resources