Author -  Sai gowtham

Specifying a required Node.js version in Package.json file

In this tutorial, we are going to learn about how to specify a required node version inside your package.json file.

If we specify the required node.js version in package.json file npm will notify the users that our project only runs on a particular node version.

Specifying the Node version

  1. Open the node project in your favorite code editor.

  2. Navigate to the package.json file and add the following engines field by replacing it with your required node version.

"engines": {
    "node": ">=12"
},

Here I set a node version >=12 so that my project only works on node version 12 and above.

  1. Create a .npmrc file in your project root folder and the following config.
.npmrc
engine-strict=true

This will give an error to the user if he or she uses different node versions (other than specified).

npm ERR! code ENOTSUP
npm ERR! notsup Unsupported engine for node-app@1.0.0:
wanted: {"node":">=8"} (current: {"node":"10.14.1","npm":"6.13.4"})
npm ERR! notsup Not compatible with your version of node/npm: node-app@1.0.0
npm ERR! notsup Not compatible with your version of node/npm: node-app@1.0.0
npm ERR! notsup Required: {"node":">=12"}
npm ERR! notsup Actual:   {"npm":"6.13.4","node":"10.14.1"}

npm ERR! A complete log of this run can be found in:

Css Tutorials & Demos

How rotate an image continuously in CSS

In this demo, we are going to learn about how to rotate an image continuously using the css animations.

How to create a Instagram login Page

In this demo, i will show you how to create a instagram login page using html and css.

How to create a pulse animation in CSS

In this demo, i will show you how to create a pulse animation using css.

Creating a snowfall animation using css and JavaScript

In this demo, i will show you how to create a snow fall animation using css and JavaScript.

Top Udemy Courses

JavaScript - The Complete Guide 2023 (Beginner + Advanced)
JavaScript - The Complete Guide 2023 (Beginner + Advanced)
116,648 students enrolled
52 hours of video content
$14.99 FROM UDEMY
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
631,582 students enrolled
49 hours of video content
$24.99 FROM UDEMY
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
203,937 students enrolled
31.5 hours of video content
$14.99 FROM UDEMY