top of page
Logo der Online Agentur mdwp

npm (Node Package Manager)

npm, or Node Package Manager, is not exclusive to React JS but is a crucial part of the ecosystem. It's a tool primarily used to install and manage node modules in a JavaScript project. Node modules are pre-built libraries or bits of code that perform common tasks. They are used to separate concerns and create less cluttered, more maintainable codebases. npm provides an online repository for hosting these modules for users to download and incorporate into their projects.

npm comes with Node.js when it's installed, so there's no need to install it separately. Through the command line, npm can add packages to a project, update or remove them, and manage the project's dependencies.

For instance, to install a package, navigate to your project directory in your command line interface and use the following command:

npm install <package-name>

Replace "<package-name>" with the name of the package you want to install. For instance, to install React into your project, you would use:
npm install react

This would download the React library and any of its dependencies into a node_modules folder inside your project. The details about what packages have been installed are stored in a 'package.json' file in your project directory. You can also use npm to install specific versions of a package, update packages, and more. It's an indispensable tool in modern JavaScript, and especially React, development.

bottom of page