NPM Commands Every Developer Should Know.
📌
Initializes the package.json file of a project.
Use the -y flag to skip the questions and to create a package.json using default values.
📌
Installs the dependencies listed in package.json.
Shorthand:
📌
Installs a package from the npm registry.
Shorthand:
📌
Installs a package globally on your machine.
📌
Like the command itself suggests, it uninstalls packages that are already installed.
Shorthand:
📌
Uninstalls a global package from your machine.
📌
Updates the specified package to the latest version available. If 'package' is not specified, it updates every package.
Shorthand:
📌
Updates a global package to the latest version available.
📌
Lists all the installed packages and their versions, along with their dependencies in a tree structure.
📌
Shows available details about the specified package. If the version is not set, it defaults to the latest version.
📌
Executes the specified 'script', if found as a property of the 'script' object in package.json.
📌
Tries to show the appropriate documentation page for the term provided.
#NPM #Commands #Devloper
📌
npm init
Initializes the package.json file of a project.
Use the -y flag to skip the questions and to create a package.json using default values.
📌
npm install
Installs the dependencies listed in package.json.
Shorthand:
npm i
📌
npm install <package>
Installs a package from the npm registry.
Shorthand:
npm i <package>
📌
npm install -g <package>
Installs a package globally on your machine.
📌
npm uninstall <package>
Like the command itself suggests, it uninstalls packages that are already installed.
Shorthand:
npm un <package>
📌
npm uninstall -g <package>
Uninstalls a global package from your machine.
📌
npm update <package>
Updates the specified package to the latest version available. If 'package' is not specified, it updates every package.
Shorthand:
npm up <package>
📌
npm update -g <package>
Updates a global package to the latest version available.
📌
npm list
Lists all the installed packages and their versions, along with their dependencies in a tree structure.
📌
npm view <package> <version>
Shows available details about the specified package. If the version is not set, it defaults to the latest version.
📌
npm run <script>
Executes the specified 'script', if found as a property of the 'script' object in package.json.
📌
npm help <term>
Tries to show the appropriate documentation page for the term provided.
#NPM #Commands #Devloper