Node.js tips and tricks: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 75: | Line 75: | ||
node -> stable (-> v18.16.0) (default) | node -> stable (-> v18.16.0) (default) | ||
stable -> 18.16 (-> v18.16.0) (default) | stable -> 18.16 (-> v18.16.0) (default) | ||
# Install new version of node | |||
$ nvm install <version you want to> | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== References == | == References == | ||
<references /> | <references /> |
Revision as of 13:13, 15 October 2024
Update nodejs package.json
# Install npm-check-updates globally
$ npm i -g npm-check-updates
# Inside of nodejs project folder where package.json is located
$ ncu -u
Upgrading /opt/imp/home/prj/rim/package.json
[====================] 39/39 100%
async ^2.6.3 → ^3.2.6
canvas-gauges ^2.1.5 → ^2.1.7
cheerio ^1.0.0-rc.2 → ^1.0.0
cookie-parser ^1.4.4 → ^1.4.7
....
# Run npm install to install new versions.
$ npm install
Install latest Node.js[1]
#Install Node.js 20.x LTS
$curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
$sudo apt-get install -y nodejs
Change node version
# Get available version list using nvm
$ nvm ls
v4.9.1
v6.17.1
v8.8.1
v8.9.4
v8.17.0
v10.24.1
-> v14.15.1
v16.20.0
v18.16.0
system
default -> v14.15.1
# change version v18 temporary and check the changing version
$ nvm use v18.16.0
$ nvm ls
v4.9.1
v6.17.1
v8.8.1
v8.9.4
v8.17.0
v10.24.1
v14.15.1
v16.20.0
-> v18.16.0
system
default -> v14.15.1 << default version will not be changed
# change default version v18 sytemwide
$ nvm alias default v18
default -> v18 (-> v18.16.0)
$ nvm ls
v4.9.1
v6.17.1
v8.8.1
v8.9.4
v8.17.0
v10.24.1
v14.15.1
v16.20.0
-> v18.16.0
system
default -> v18 (-> v18.16.0) << default version has been changed
node -> stable (-> v18.16.0) (default)
stable -> 18.16 (-> v18.16.0) (default)
# Install new version of node
$ nvm install <version you want to>