====== Node.js / NPM ====== ===== Installation ===== Installation, ne surtout pas installer nodejs dispo dans les dépots debian, ils sont obsolètes. Utiliser la dernière méthode https://github.com/nodesource/distributions#debian-and-ubuntu-based-distributions sudo apt-get update sudo apt-get install -y ca-certificates curl gnupg sudo mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg Important de rajouter le ARCH qui n'est pas mentionné dans la doc officiel NODE_MAJOR=18 ARCH=amd64 echo "deb [arch=$ARCH signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list CE QUI SUIT DEVIENT OBSOLETE !!! Utilisez la démarche décrite sur le site officiel => https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions => https://github.com/nodesource/distributions/blob/master/README.md curl -sL https://deb.nodesource.com/setup_13.x | bash - ## Run `sudo apt-get install -y nodejs` to install Node.js 13.x and npm ## You may also need development tools to build native addons: sudo apt-get install gcc g++ make ## To install the Yarn package manager, run: curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update && sudo apt-get install yarn apt-get install nodejs # npm -v 6.13.6 # node -v v13.7.0 En cas de problème, n'hésitez pas à supprimer tout ce qui concerne node_modules, surtout rm -fr ~/.npm rm -fr /root/.npm ===== Mettre à jour ===== npm npm -g install npm@latest nodeJS npm cache clean -f npm install -g n n stable