SUNT的随手记

闲的时候,做一些对自己有益的事

0%

debian11升级nodejs

debian11包管理工具中的的nodejs不是最新版本,使用 nodesource 提供脚本更新deb源,使用apt-get更新呢nodejs

nodesource 服务下载需要的 Node.js 安装脚本

示例:

更新nodejsdeb

1
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -

更新nodejs版本

1
apt-get install nodejs -y

查看nodejs版本

1
node -v

过程演示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
root@VM12138:~$ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
2024-11-10 12:33:13 - Installing pre-requisites
Hit:1 https://download.docker.com/linux/debian bullseye InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease
Hit:3 http://security.debian.org/debian-security bullseye-security InRelease
Hit:4 http://ftp.debian.org/debian bullseye-backports InRelease
Hit:5 http://deb.debian.org/debian bullseye-updates InRelease
Hit:6 http://deb.debian.org/debian bullseye-backports InRelease
Get:7 https://deb.sagernet.org * InRelease
Fetched 9,518 B in 44s (216 B/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
apt-transport-https is already the newest version (2.2.4).
ca-certificates is already the newest version (20210119).
gnupg is already the newest version (2.2.27-2+deb11u2).
curl is already the newest version (7.88.1-10+deb12u6~bpo11+1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Hit:1 https://download.docker.com/linux/debian bullseye InRelease
Hit:2 http://security.debian.org/debian-security bullseye-security InRelease
Hit:3 http://deb.debian.org/debian bullseye InRelease
Hit:4 http://ftp.debian.org/debian bullseye-backports InRelease
Hit:5 http://deb.debian.org/debian bullseye-updates InRelease
Get:6 https://deb.nodesource.com/node_20.x nodistro InRelease [12.1 kB]
Hit:7 http://deb.debian.org/debian bullseye-backports InRelease
Get:8 https://deb.nodesource.com/node_20.x nodistro/main amd64 Packages [9,577 B]
Get:9 https://deb.sagernet.org * InRelease
Fetched 31.2 kB in 44s (704 B/s)
Reading package lists... Done
2024-11-10 12:34:59 - Repository configured successfully.
2024-11-10 12:34:59 - To install Node.js, run: apt-get install nodejs -y
2024-11-10 12:34:59 - You can use N|solid Runtime as a node.js alternative
2024-11-10 12:34:59 - To install N|solid Runtime, run: apt-get install nsolid -y

root@VM12138:~$ sudo apt-get install nodejs -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
adwaita-icon-theme at-spi2-core dconf-gsettings-backend dconf-service fontconfig glib-networking glib-networking-common glib-networking-services
gsettings-desktop-schemas gtk-update-icon-cache gyp hicolor-icon-theme javascript-common libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data libatspi2.0-0
libauthen-sasl-perl libavahi-client3 libavahi-common-data libavahi-common3 libc-ares2 libcairo-gobject2 libcairo2 libclone-perl libcolord2 libcups2
libdata-dump-perl libdatrie1 libdconf1 libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libencode-locale-perl libepoxy0
libfile-basedir-perl libfile-desktopentry-perl libfile-listing-perl libfile-mimeinfo-perl libfont-afm-perl libfontenc1 libgdk-pixbuf-2.0-0
libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-common libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libgraphite2-3 libgtk-3-0 libgtk-3-bin
libgtk-3-common libharfbuzz0b libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl libhtml-tree-perl libhttp-cookies-perl
libhttp-daemon-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl libice6 libio-html-perl libio-socket-ssl-perl libio-stringy-perl
libipc-system-simple-perl libjs-highlight.js libjs-inherits libjs-is-typedarray libjs-psl libjs-typedarray-to-buffer libjson-glib-1.0-0
libjson-glib-1.0-common liblcms2-2 libllvm11 liblwp-mediatypes-perl liblwp-protocol-https-perl libmailtools-perl libnet-dbus-perl libnet-http-perl
libnet-smtp-ssl-perl libnet-ssleay-perl libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0 libpixman-1-0 libproxy1v5 librest-0.7-0
librsvg2-2 librsvg2-common libsensors-config libsensors5 libsm6 libsoup-gnome2.4-1 libsoup2.4-1 libthai-data libthai0 libtie-ixhash-perl libtimedate-perl
libtry-tiny-perl liburi-perl libuv1-dev libvte-2.91-0 libvte-2.91-common libvulkan1 libwayland-client0 libwayland-cursor0 libwayland-egl1 libwww-perl
libwww-robotrules-perl libx11-protocol-perl libx11-xcb1 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-render0
libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxft2 libxi6 libxinerama1 libxkbcommon0
libxkbfile1 libxml-parser-perl libxml-twig-perl libxml-xpathengine-perl libxmu6 libxrandr2 libxrender1 libxshmfence1 libxt6 libxtst6 libxv1 libxxf86dga1
libxxf86vm1 libz3-4 mesa-vulkan-drivers node-abbrev node-agent-base node-ajv node-ansi node-ansi-regex node-ansi-styles node-ansistyles node-aproba
node-archy node-are-we-there-yet node-asap node-asn1 node-assert-plus node-asynckit node-aws-sign2 node-aws4 node-balanced-match node-bcrypt-pbkdf
node-brace-expansion node-builtins node-cacache node-caseless node-chalk node-chownr node-clone node-color-convert node-color-name node-colors
node-columnify node-combined-stream node-concat-map node-console-control-strings node-copy-concurrently node-core-util-is node-dashdash node-debug
node-defaults node-delayed-stream node-delegates node-depd node-ecc-jsbn node-encoding node-err-code node-escape-string-regexp node-extend node-extsprintf
node-fast-deep-equal node-forever-agent node-form-data node-fs-write-stream-atomic node-fs.realpath node-function-bind node-gauge node-getpass node-glob
node-graceful-fs node-har-schema node-har-validator node-has-flag node-has-unicode node-hosted-git-info node-http-signature node-https-proxy-agent
node-iconv-lite node-iferr node-imurmurhash node-indent-string node-inflight node-inherits node-ini node-ip node-ip-regex node-is-typedarray node-isarray
node-isexe node-isstream node-jsbn node-json-parse-better-errors node-json-schema node-json-schema-traverse node-json-stable-stringify
node-json-stringify-safe node-jsonify node-jsonparse node-jsonstream node-jsprim node-leven node-lockfile node-lru-cache node-mime node-mime-types
node-minimatch node-mkdirp node-move-concurrently node-ms node-mute-stream node-nopt node-normalize-package-data node-npm-bundled node-npm-package-arg
node-npmlog node-number-is-nan node-oauth-sign node-object-assign node-once node-opener node-osenv node-p-map node-path-is-absolute node-performance-now
node-process-nextick-args node-promise-inflight node-promise-retry node-promzard node-psl node-puka node-punycode node-qs node-read node-read-package-json
node-readable-stream node-request node-resolve node-resolve-from node-retry node-rimraf node-run-queue node-safe-buffer node-semver node-set-blocking
node-signal-exit node-slash node-spdx-correct node-spdx-exceptions node-spdx-expression-parse node-spdx-license-ids node-sshpk node-ssri
node-string-decoder node-string-width node-strip-ansi node-supports-color node-tar node-text-table node-through node-tough-cookie node-tunnel-agent
node-tweetnacl node-typedarray-to-buffer node-unique-filename node-universalify node-uri-js node-util-deprecate node-uuid
node-validate-npm-package-license node-validate-npm-package-name node-verror node-wcwidth.js node-which node-wide-align node-wrappy node-write-file-atomic
node-yallist perl-openssl-defaults python3-pkg-resources termit x11-common x11-utils x11-xserver-utils xdg-utils xkb-data
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
libnode-dev libnode72 node-gyp nodejs-doc npm
The following packages will be upgraded:
nodejs
1 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
Need to get 31.8 MB of archives.
After this operation, 144 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_20.x nodistro/main amd64 nodejs amd64 20.18.0-1nodesource1 [31.8 MB]
Fetched 31.8 MB in 54s (592 kB/s)
(Reading database ... 44332 files and directories currently installed.)
Removing npm (7.5.2+ds-2) ...
Removing node-gyp (7.1.2-4) ...
Removing libnode-dev (12.22.12~dfsg-1~deb11u5) ...
Removing nodejs-doc (12.22.12~dfsg-1~deb11u5) ...
dpkg: libnode72:amd64: dependency problems, but removing anyway as you requested:
nodejs depends on libnode72 (= 12.22.12~dfsg-1~deb11u5).

Removing libnode72:amd64 (12.22.12~dfsg-1~deb11u5) ...
(Reading database ... 43186 files and directories currently installed.)
Preparing to unpack .../nodejs_20.18.0-1nodesource1_amd64.deb ...
Unpacking nodejs (20.18.0-1nodesource1) over (12.22.12~dfsg-1~deb11u5) ...
Setting up nodejs (20.18.0-1nodesource1) ...
Processing triggers for libc-bin (2.31-13+deb11u11) ...
Processing triggers for man-db (2.9.4-2) ...
root@VM12138:~$ node -v
v20.18.0