Node.js
Node versions, npm, pnpm and Yarn. 13 commands.
- Install Node.jsThe latest long-term-support version of Node.js, with npm.
- Switch Node.js versions with nvmInstall several Node.js versions side by side and switch between them per project.
- Fix npm "ERESOLVE unable to resolve dependency tree"Two packages want different versions of the same thing. Find the clash and update, or install around it for now.
- Delete node_modules and reinstall cleanlyWhen packages act strangely, throw node_modules away and install exactly what the lock file lists.
- Fix ENOSPC "System limit for number of file watchers reached"Linux caps how many files a program can watch for changes. Big projects with a dev server hit the cap. Raise it once and it stays.
- Fix Node "Cannot find module"Node can't find a package or file your code asks for. Usually the packages aren't installed yet or the name is wrong.
- Fix node-gyp build errors during npm installSome packages build a small piece of C++ when they install. The fix is almost always to install the build tools and Python, then reinstall.
- Fix npm "EACCES: permission denied"When npm install -g fails with a permission error. Install global packages in your own folder instead of using sudo.
- Install pnpm and YarnThe two popular alternatives to npm, installed globally with npm itself.
- Uninstall Node.js completelyRemove Node.js, npm and their leftover folders, ready for a clean install.
- Update Node.jsMove to the latest long-term-support version of Node.js.
- Update npm and your global packagesBring npm itself and the tools you installed with npm install -g up to date.
- Update your project's npm packagesSee what's out of date in package.json, and update safely or to the latest.