NodeJS - zacisco/notes GitHub Wiki
Node Manager
For single/local development
FNM (preferred)
go to FNM Repo
NVM
go to NVM Repo
N
go to N Repo
NodeJS itself
Download
https://nodejs.org/en/download/ - LTS
https://nodejs.org/en/download/current/ - Current
Unpack and install
unpack to bin,include,man,share to /usr/local
or
unpack all to /opt
chown -R root:root _path_to_nodejs_
chmod -R +w _path_to_nodejs_
in /etc/profiles.d
echo export PATH=$PATH:_path_to_nodejs_/bin > nodejs.sh
for apply now:
. /etc/profiles.d/./nodejs.sh
Enable Corepack
Node.js >= 16.10:
corepack enable
Node.js < 16.10:
npm i -g corepack
Package manager
PNPM (preferred)
corepack prepare pnpm@latest --activate
Bun (faster,younger)
go to Bun site
Yarn
yarn init -2 - By default, yarn init -2 will setup your project to be compatible with Zero-Installs, which requires checking-in your cache in your repository; check your .gitignore if you wish to disable this.
Yarn update
yarn set version stable
NPM
in nodejs bundle
Bundlers
Vite (preferred)
pnpm create vite my-app --template svelte # или react, vue
or
bun create vite my-app --template svelte # или react, vue
Webpack Dev Server
Migrate from v3 to v4 and Migrate from v3 to v4 issues
"start": "webpack serve --mode development --hot" - run dev-server through @webpack-cli/serve