notes/logseq/bak/nodejs/2023-01-13T01_15_47.938Z.Desktop.md

1.0 KiB

version management

nvm

can use nvm to manage nodejs versions. not really sure how this works, but it is per user and operates off bash scripts and variables

going to have to pull from github. It will curl to clone the repo and then add some stuff to your bashrc to make it work. exec bash after install to refresh

nvm install --lts nvm use version

npm n helper

npm can be used to manage node itself through n https://github.com/tj/n

sudo npm cache clean -f

  1. setup & own directyory with versions
    • sudo mkdir -p /usr/local/n
    • sudo chown -R $(whoami) /usr/local/n
  2. own the instalation folders
    • sudo chown -R $(whoami) /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share
  3. install n: sudo npm install -g n

upgrading npm in windows

npm install -g npm-windows-upgrade or just download from the wesite

npm

to update npm do npm install npm@latest -g