Centos에 Nodejs를 설치할 때 문제가 발생했습니다(yum을 사용하고 소스에서 빌드).

Centos에 Nodejs를 설치할 때 문제가 발생했습니다(yum을 사용하고 소스에서 빌드).

CentOS에 최신 Nodejs를 설치하려고 합니다.

[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

내가 뭘 잘못했나요? 어떻게 해결할 수 있나요? (저는 이 지시를 따르려고 노력하고 있습니다.여기에 링크 설명을 입력하세요)

고쳐 쓰다: npm 업데이트를 시도했지만 결과가 없습니다.

# 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

소스에서 빌드를 시도했지만 컴파일할 수 없습니다.

[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

답변1

오늘 이것을 오랜 시간 동안 살펴보았는데 솔루션의 90%가 다음과 같이 캡슐화되어 있는 것 같습니다.노드 소스 문서. v.14.x 설치 방법(15는 너무 새롭고 14는 현장 테스트가 더 좋기 때문에)...

Node.js v14.x

루트 사용자로

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

루트 권한 없음

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

그러나 버전을 설치한 후에는 메타데이터 캐시를 새로 고쳐 사용 가능한 최신 종속성이 포함된 빌드를 curl트리거해야 합니다 . yum update그렇지 않으면 yum update이전 종속성이 계속 선호되며 이는 새 패키지와 호환되지 않습니다. 메타데이터 캐시를 지워서 yum clean all함께...

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

답변2

npm이전 버전이 설치되어 있는 것 같습니다 nodejs = 1:6.17.1-1.el7. 이는 필수입니다. 또한 npm을 업그레이드해 보세요. 이상하게도 yum이렇게 하는 것은 권장되지 않습니다. 그가 npm도 업그레이드하도록 강제하려면 다음을 시도해 보세요.

yum install nodejs npm

관련 정보