2023年3月20日 星期一

[研究]Node.js 18.x 和 npm 9.5.0 安裝 (Rcoky Linux 9.1)

[研究]Node.js 18.x 和 npm 9.5.0 安裝 (Rcoky Linux 9.1)

2023-03-20

[user1@localhost ~]$ curl -sL https://rpm.nodesource.com/setup_18.x | sudo bash -

## Installing the NodeSource Node.js 18.x repo...


## Inspecting system...

+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release || rpm -q --whatprovides fedora-release
+ uname -m

## Confirming "el9-x86_64" is supported...

+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_18.x/el/9/x86_64/nodesource-release-el9-1.noarch.rpm'

## Downloading release setup RPM...

+ mktemp
+ curl -sL -o '/tmp/tmp.T33cMWwyE0' 'https://rpm.nodesource.com/pub_18.x/el/9/x86_64/nodesource-release-el9-1.noarch.rpm'

## Installing release setup RPM...

+ rpm -i --nosignature --force '/tmp/tmp.T33cMWwyE0'

## Cleaning up...

+ rm -f '/tmp/tmp.T33cMWwyE0'

## Checking for existing installations...

+ rpm -qa 'node|npm' | grep -v nodesource

## Run `sudo yum install -y nodejs` to install Node.js 18.x and npm.
## You may run dnf if yum is not available:
     sudo dnf install -y nodejs
## You may also need development tools to build native addons:
     sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
     sudo yum install yarn

[user1@localhost ~]$ 

注意,nodejs是連在一起,不是 node.js

[user1@localhost ~]$ sudo dnf -y install nodejs
Last metadata expiration check: 0:00:25 ago on Mon 20 Mar 2023 09:17:41 PM CST.
Dependencies resolved.
================================================================================
 Package      Architecture Version                       Repository        Size
================================================================================
Installing:
 nodejs       x86_64       2:18.15.0-1nodesource         nodesource        34 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 34 M
Installed size: 99 M
Downloading Packages:
nodejs-18.15.0-1nodesource.x86_64.rpm           5.8 MB/s |  34 MB     00:05    
--------------------------------------------------------------------------------
Total                                           5.8 MB/s |  34 MB     00:05     
Node.js Packages for Enterprise Linux 9 - x86_6 1.6 MB/s | 1.6 kB     00:00    
Importing GPG key 0x34FA74DD:
 Userid     : "NodeSource <gpg-rpm@nodesource.com>"
 Fingerprint: 2E55 207A 95D9 944B 0CC9 3261 5DDB E8D4 34FA 74DD
 From       : /etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Running scriptlet: nodejs-2:18.15.0-1nodesource.x86_64                    1/1 
  Installing       : nodejs-2:18.15.0-1nodesource.x86_64                    1/1 
  Running scriptlet: nodejs-2:18.15.0-1nodesource.x86_64                    1/1 
  Verifying        : nodejs-2:18.15.0-1nodesource.x86_64                    1/1 

Installed:
  nodejs-2:18.15.0-1nodesource.x86_64                                           

Complete!
[user1@localhost ~]$ 



[user1@localhost ~]$ node -v
v18.15.0
[user1@localhost ~]$ node 
Welcome to Node.js v18.15.0.
Type ".help" for more information.
> .exit
[user1@localhost ~]$ 




[user1@localhost ~]$ sudo dnf -y install npm
Last metadata expiration check: 0:02:40 ago on Mon 20 Mar 2023 09:17:41 PM CST.
Dependencies resolved.
================================================================================
 Package             Arch      Version                       Repository    Size
================================================================================
Installing:
 npm                 x86_64    1:8.19.2-1.16.18.1.3.el9_1    appstream    1.8 M
Installing dependencies:
 nodejs-libs         x86_64    1:16.18.1-3.el9_1             appstream     14 M
Installing weak dependencies:
 nodejs-docs         noarch    1:16.18.1-3.el9_1             appstream    7.0 M
 nodejs-full-i18n    x86_64    1:16.18.1-3.el9_1             appstream    8.2 M
Downgrading:
 nodejs              x86_64    1:16.18.1-3.el9_1             appstream    111 k

Transaction Summary
================================================================================
Install    4 Packages
Downgrade  1 Package

Total download size: 32 M
Downloading Packages:
(1/5): nodejs-16.18.1-3.el9_1.x86_64.rpm        581 kB/s | 111 kB     00:00    
(2/5): npm-8.19.2-1.16.18.1.3.el9_1.x86_64.rpm  1.7 MB/s | 1.8 MB     00:01    
(3/5): nodejs-full-i18n-16.18.1-3.el9_1.x86_64. 2.2 MB/s | 8.2 MB     00:03    
(4/5): nodejs-docs-16.18.1-3.el9_1.noarch.rpm   2.4 MB/s | 7.0 MB     00:02    
(5/5): nodejs-libs-16.18.1-3.el9_1.x86_64.rpm   3.1 MB/s |  14 MB     00:04    
--------------------------------------------------------------------------------
Total                                           5.6 MB/s |  32 MB     00:05     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: npm-1:8.19.2-1.16.18.1.3.el9_1.x86_64                  1/1 
  Preparing        :                                                        1/1 
Transaction couldn't start:
file /usr/lib/node_modules/npm/docs from install of npm-1:8.19.2-1.16.18.1.3.el9_1.x86_64 conflicts with file from package nodejs-2:18.15.0-1nodesource.x86_64
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Could not run transaction.
[user1@localhost ~]$ npm -v
9.5.0
[user1@localhost ~]$ 

(完)

相關

[研究]Node.js 12.22.9 和 npm 8.5.1 安裝 (Ubuntu 22.04.2 LTS)
https://shaurong.blogspot.com/2023/03/nodejs-12229-npm-851-ubuntu-22042-lts.html

[研究]Node.js 18.x 和 npm 9.5.0 安裝 (Rcoky Linux 9.1)
https://shaurong.blogspot.com/2023/03/nodejs-18x-rcoky-linux-91.html


沒有留言:

張貼留言