This is the sixth day of my participation in the August Text Challenge.More challenges in August

NPM

NPM stands for Node Package Manager. It is the Node.js Package Manager whose goal is to automate dependency and Package management.

This means that you can specify all dependencies (packages) for your project in a package.json file, and when you need to install dependencies for it, you can simply run NPM Install.

NPM itself cannot execute any packages. For packages of local projects, if you want to execute them, you need to write them to package.json, and then use NPM to parse the package.json file to the bin file path of the package and execute them under bash.

NPX

NPX is a tool, a command (NPX) introduced in NPM V5.2.0, an NPM package executable that refers to improving the experience when using packages from the NPM registry. NPM makes it very easy to install and manage dependencies hosted on the registry. NPX makes it easy to use CLI tools and other hosted on the registry.

So now most developers can use NPX directly.

NPX is still a simple CLI tool that makes it easier to execute some NPM packages without having to install them on the developer’s computer via NPM.

Main features: 1, temporary installation can execute the dependency package, no global installation, do not worry about long-term pollution. 2, you can execute the command in the dependency package, the installation is completed automatically run. 3, automatically load node_modules dependencies without specifying $PATH. 4. You can specify the node version and command version, which solves the problem of using different versions of commands for different projects.

conclusion

NPX extends the NPM file execution functionality and provides a new way to use the Node. js CLI tool that is more flexible and less polluting with local environment variables than before. (Check out your Node installation directory. How many soft links in the bin directory are contaminating your environment variables). Specifying the functionality of the package version gives us the flexibility to test new features without upgrading and downgrading, which is a great convenience.