

We recommend using a version manager as versions change very quickly. Install nvm-windows, node.js, and npmīesides choosing whether to install on Windows or WSL, there are additional choices to make when installing Node.js. However, you may think the latest safe version hasn’t been installed because package.json is unchanged, but if you check the packages in the node_modules folder, the latest safe version will have been installed.If you are using Node.js professionally, find performance speed and system call compatibility important, want to run Docker containers that leverage Linux workspaces and avoid having to maintain both Linux and Windows build scripts, or just prefer using a Bash command line, then install Node.js on Windows Subsystem for Linux (more specifically, WSL 2).

Npm install will install the latest safe version of the dependencies if they don’t exist in the node_modules folder and, there is no package-lock.json file. If the packages haven’t been installed and a package-lock.json file exists, then npm install will install the exact dependency versions specified in package-lock.json. If the packages have already been installed into the node_modules folder, then npm install won’t update any packages. So, npm install installs the latest safe version of the dependencies? So in this example, ^16.8.12 can be safely installed if this was the newest version in 16.8.x.

This means that only the latest patch version can be safely installed. Sometimes a version has a ~ in front of it (e.g. So in this example, ^16.12.1 can be safely installed if this was the newest version in 16.x. This means that the latest minor version can be safely installed. This is incremented when breaking changes are madeĪ version often has a ^ in front of it (e.g.

This is incremented when features are added that won’t break consuming code This is incremented when a bug fix is made that won’t break consuming code Npm package versioning follows semantic versioning. How can we safely upgrade the npm dependencies in our project? What do the funny ^ and ~ characters mean in front of the dependency package versions? How can we do a major version upgrade on an npm dependency in our project? We’ll find out in this post.
