What is the Purpose of the ‘node_modules’ Folder?

node_modules is a folder which stores external dependencies of the project. Whenever we install some external package through “npm” or “yarn” in a project locally, it gets stored into the node_modules folder located at the root of the project directory by default. It also stores all the nested dependencies of the packages that we install. So, when we use the installed package with “require” or “import”, it locates those packages from the node_modules folder.

Also, it is advisable to not modify and copy node_modules folder to any other system because the packages installed within may differ in the versioning and operating system configurations.

Subscribe for
weekly updates