4

I am trying to install lastest nodejs on CentOS:

[root@test-visitele ~]# uname -a
Linux test-visitele 3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@test-visitele ~]# sudo yum install epel-release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.alpha-labs.net
 * epel: ftp.plusline.net
 * extras: mirror.23media.com
 * updates: mirror.23media.com
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be updated
---> Package epel-release.noarch 0:7-12 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================
 Package                   Arch                Version           Repository         Size
=========================================================================================
Updating:
 epel-release              noarch              7-12              epel               15 k

Transaction Summary
=========================================================================================
Upgrade  1 Package

Total download size: 15 k
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
epel-release-7-12.noarch.rpm                                      |  15 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Updating   : epel-release-7-12.noarch                                              1/2 
  Cleanup    : epel-release-7-11.noarch                                              2/2 
  Verifying  : epel-release-7-12.noarch                                              1/2 
  Verifying  : epel-release-7-11.noarch                                              2/2 

Updated:
  epel-release.noarch 0:7-12                                                             

Complete!
[root@test-visitele ~]# sudo yum install nodejs
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centosmirror.netcup.net
 * epel: ftp.plusline.net
 * extras: mirror.23media.com
 * updates: mirror.23media.com
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 1:6.17.1-1.el7 will be updated
--> Processing Dependency: nodejs = 1:6.17.1-1.el7 for package: 1:npm-3.10.10-1.6.17.1.1.el7.x86_64
---> Package nodejs.x86_64 2:10.20.1-1nodesource will be an update
--> Finished Dependency Resolution
Error: Package: 1:npm-3.10.10-1.6.17.1.1.el7.x86_64 (@epel)
           Requires: nodejs = 1:6.17.1-1.el7
           Removing: 1:nodejs-6.17.1-1.el7.x86_64 (@epel)
               nodejs = 1:6.17.1-1.el7
           Updated By: 2:nodejs-10.20.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.20.1-1nodesource
           Available: 2:nodejs-10.0.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.0.0-1nodesource
           Available: 2:nodejs-10.1.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.1.0-1nodesource
           Available: 2:nodejs-10.2.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.2.1-1nodesource
           Available: 2:nodejs-10.3.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.3.0-1nodesource
           Available: 2:nodejs-10.4.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.4.0-1nodesource
           Available: 2:nodejs-10.4.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.4.1-1nodesource
           Available: 2:nodejs-10.5.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.5.0-1nodesource
           Available: 2:nodejs-10.6.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.6.0-1nodesource
           Available: 2:nodejs-10.7.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.7.0-1nodesource
           Available: 2:nodejs-10.8.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.8.0-1nodesource
           Available: 2:nodejs-10.9.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.9.0-1nodesource
           Available: 2:nodejs-10.10.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.10.0-1nodesource
           Available: 2:nodejs-10.11.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.11.0-1nodesource
           Available: 2:nodejs-10.12.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.12.0-1nodesource
           Available: 2:nodejs-10.13.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.13.0-1nodesource
           Available: 2:nodejs-10.14.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.14.1-1nodesource
           Available: 2:nodejs-10.14.2-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.14.2-1nodesource
           Available: 2:nodejs-10.15.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.15.0-1nodesource
           Available: 2:nodejs-10.15.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.15.1-1nodesource
           Available: 2:nodejs-10.15.2-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.15.2-1nodesource
           Available: 2:nodejs-10.15.3-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.15.3-1nodesource
           Available: 2:nodejs-10.16.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.16.0-1nodesource
           Available: 2:nodejs-10.16.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.16.1-1nodesource
           Available: 2:nodejs-10.16.2-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.16.2-1nodesource
           Available: 2:nodejs-10.16.3-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.16.3-1nodesource
           Available: 2:nodejs-10.17.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.17.0-1nodesource
           Available: 2:nodejs-10.18.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.18.0-1nodesource
           Available: 2:nodejs-10.18.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.18.1-1nodesource
           Available: 2:nodejs-10.19.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.19.0-1nodesource
           Available: 2:nodejs-10.20.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.20.0-1nodesource
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

What am I doing wrong? How can I fix it? (I am trying to follow this instruction enter link description here)

UPDATE: trying to update npm gives nothing

# yum install nodejs npm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centosmirror.netcup.net
 * epel: ftp.plusline.net
 * extras: mirror.23media.com
 * updates: mirror.23media.com
digitalocean-agent                                                | 3.3 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 2:10.20.1-1nodesource will be installed
---> Package npm.x86_64 1:3.10.10-1.6.17.1.1.el7 will be installed
--> Processing Dependency: nodejs = 1:6.17.1-1.el7 for package: 1:npm-3.10.10-1.6.17.1.1.el7.x86_64
--> Finished Dependency Resolution
Error: Package: 1:npm-3.10.10-1.6.17.1.1.el7.x86_64 (epel)
           Requires: nodejs = 1:6.17.1-1.el7
           Available: 1:nodejs-6.17.1-1.el7.x86_64 (epel)
               nodejs = 1:6.17.1-1.el7
           Available: 2:nodejs-10.0.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.0.0-1nodesource
           Available: 2:nodejs-10.1.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.1.0-1nodesource
           Available: 2:nodejs-10.2.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.2.1-1nodesource
           Available: 2:nodejs-10.3.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.3.0-1nodesource
           Available: 2:nodejs-10.4.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.4.0-1nodesource
           Available: 2:nodejs-10.4.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.4.1-1nodesource
           Available: 2:nodejs-10.5.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.5.0-1nodesource
           Available: 2:nodejs-10.6.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.6.0-1nodesource
           Available: 2:nodejs-10.7.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.7.0-1nodesource
           Available: 2:nodejs-10.8.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.8.0-1nodesource
           Available: 2:nodejs-10.9.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.9.0-1nodesource
           Available: 2:nodejs-10.10.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.10.0-1nodesource
           Available: 2:nodejs-10.11.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.11.0-1nodesource
           Available: 2:nodejs-10.12.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.12.0-1nodesource
           Available: 2:nodejs-10.13.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.13.0-1nodesource
           Available: 2:nodejs-10.14.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.14.1-1nodesource
           Available: 2:nodejs-10.14.2-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.14.2-1nodesource
           Available: 2:nodejs-10.15.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.15.0-1nodesource
           Available: 2:nodejs-10.15.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.15.1-1nodesource
           Available: 2:nodejs-10.15.2-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.15.2-1nodesource
           Available: 2:nodejs-10.15.3-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.15.3-1nodesource
           Available: 2:nodejs-10.16.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.16.0-1nodesource
           Available: 2:nodejs-10.16.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.16.1-1nodesource
           Available: 2:nodejs-10.16.2-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.16.2-1nodesource
           Available: 2:nodejs-10.16.3-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.16.3-1nodesource
           Available: 2:nodejs-10.17.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.17.0-1nodesource
           Available: 2:nodejs-10.18.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.18.0-1nodesource
           Available: 2:nodejs-10.18.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.18.1-1nodesource
           Available: 2:nodejs-10.19.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.19.0-1nodesource
           Available: 2:nodejs-10.20.0-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.20.0-1nodesource
           Installing: 2:nodejs-10.20.1-1nodesource.x86_64 (nodesource)
               nodejs = 2:10.20.1-1nodesource
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Tried building from source, but it fails to compile:

[root@test-visitele node-v12.16.3]# make
make -C out BUILDTYPE=Release V=0
...

In file included from ../src/env-inl.h:27:0,
                 from ../src/api/async_resource.cc:2:
../src/aliased_buffer.h:32:22: error: expected type-specifier
           typename = std::enable_if_t<std::is_scalar<NativeT>::value>>
                      ^
../src/aliased_buffer.h:32:22: error: expected ‘>’
../src/aliased_buffer.h:65:54: error: template argument 3 is invalid
       const AliasedBufferBase<uint8_t, v8::Uint8Array>& backing_buffer)
                                                      ^
../src/aliased_buffer.h:112:45: error: template argument 3 is invalid
     Reference(AliasedBufferBase<NativeT, V8T>* aliased_buffer, size_t index)
                                             ^
../src/aliased_buffer.h:150:35: error: template argument 3 is invalid
     AliasedBufferBase<NativeT, V8T>* aliased_buffer_;
                                   ^
../src/aliased_buffer.h: In constructor ‘node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::AliasedBufferBase(v8::Isolate*, size_t, size_t, const int&)’:
../src/aliased_buffer.h:69:52: error: request for member ‘GetArrayBuffer’ in ‘backing_buffer’, which is of non-class type ‘const int’
     v8::Local<v8::ArrayBuffer> ab = backing_buffer.GetArrayBuffer();
                                                    ^
../src/aliased_buffer.h:78:45: error: request for member ‘GetNativeBuffer’ in ‘backing_buffer’, which is of non-class type ‘const int’
         const_cast<uint8_t*>(backing_buffer.GetNativeBuffer() + byte_offset));
                                             ^
../src/aliased_buffer.h: In member function ‘node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference& node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference::operator=(const NativeT&)’:
../src/aliased_buffer.h:121:24: error: request for member ‘SetValue’ in ‘((node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference*)this)->node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference::aliased_buffer_->’, which is of non-class type ‘int’
       aliased_buffer_->SetValue(index_, val);
                        ^
../src/aliased_buffer.h: In member function ‘node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference::operator NativeT() const’:
../src/aliased_buffer.h:130:31: error: request for member ‘GetValue’ in ‘((const node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference*)this)->node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference::aliased_buffer_->’, which is of non-class type ‘int’
       return aliased_buffer_->GetValue(index_);
                               ^
../src/aliased_buffer.h: In member function ‘node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference& node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference::operator+=(const NativeT&)’:
../src/aliased_buffer.h:134:48: error: request for member ‘GetValue’ in ‘((node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference*)this)->node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference::aliased_buffer_->’, which is of non-class type ‘int’
       const NativeT current = aliased_buffer_->GetValue(index_);
                                                ^
../src/aliased_buffer.h:135:24: error: request for member ‘SetValue’ in ‘((node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference*)this)->node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference::aliased_buffer_->’, which is of non-class type ‘int’
       aliased_buffer_->SetValue(index_, current + val);
                        ^
../src/aliased_buffer.h: In member function ‘node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference& node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference::operator-=(const NativeT&)’:
../src/aliased_buffer.h:144:48: error: request for member ‘GetValue’ in ‘((node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference*)this)->node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference::aliased_buffer_->’, which is of non-class type ‘int’
       const NativeT current = aliased_buffer_->GetValue(index_);
                                                ^
../src/aliased_buffer.h:145:24: error: request for member ‘SetValue’ in ‘((node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference*)this)->node::AliasedBufferBase<NativeT, V8T, <template-parameter-1-3> >::Reference::aliased_buffer_->’, which is of non-class type ‘int’
       aliased_buffer_->SetValue(index_, current - val);
                        ^
../src/aliased_buffer.h: At global scope:
../src/aliased_buffer.h:254:50: error: template argument 3 is invalid
 typedef AliasedBufferBase<int32_t, v8::Int32Array> AliasedInt32Array;
                                                  ^
...
make[1]: Leaving directory `/root/node-v12.16.3/out'
make: *** [node] Error 2
2

I spent a long time looking at this today, and it appears the solution is 90% encapsulated in the nodesource documentation. How to install v.14.x (since 15 is a bit too new and 14 is better field-tested)...

Node.js v14.x

As root

curl -fsSL https://rpm.nodesource.com/setup_14.x | bash -

No root privileges

curl -fsSL https://rpm.nodesource.com/setup_14.x | sudo bash -

After installing the version, with curl, though, you must flush your metadata-cache when doing yum update to trigger building with the newest, available dependencies. Otherwise, yum update will keep preferring the old dependency, which is incompatible with the newer packages. Clear the metadata cache with yum clean all, so, all together...

yum remove node npm nodesource-release-el7-1
curl -fsSL https://rpm.nodesource.com/setup_14.x | sudo bash -
yum clean all
yum update
0

You already seem to have an old version of npm installed which requires nodejs = 1:6.17.1-1.el7. Try upgrading npm also. It is strange that yum doesn't propose you to. Try this to force him to upgrade npm as well:

yum install nodejs npm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.