.nvmrc
Omschrijving
A .nvmrc file is a configuration file used with the Node Version Manager (NVM). It’s a simple text file placed in the root directory of a Node.js project to specify the required Node.js version for that specific project.
When you use NVM and navigate into a directory containing a .nvmrc file, running the command nvm use (without any version specified) will automatically read the .nvmrc file and switch your current shell session to the Node.js version listed in the file. If the specified version is not already installed, NVM will typically prompt you to install it.
The primary purpose of a .nvmrc file is to ensure consistency across development environments for a project. By committing the .nvmrc file to a project’s version control, all developers working on the project can easily use the exact same Node.js version, preventing potential compatibility issues that can arise from using different versions.
The content of a .nvmrc file is simply the desired Node.js version number. This can be a specific version (e.g., 14.17.0), a major or minor version (e.g., 16, 18.10), or even an LTS (Long Term Support) alias (e.g., lts/gallium).
Example .nvmrc file content:
18.17.1
or
lts/hydrogen
Using a .nvmrc file is a recommended practice for Node.js projects managed with NVM, contributing to a more stable and predictable development workflow
Relations
| Item | Type |
|---|
Pointing items
| Item | Type | Category | Tags |
|---|
| Categorie | Config, File |
| Tags | best-practice, node |
| URL | |
| Type | File |
| Time | |
| Price |