Skip to content

Instantly share code, notes, and snippets.

@nathakits
Last active June 28, 2017 03:15
Show Gist options
  • Save nathakits/90cd237f178e053b587b84235c8553ff to your computer and use it in GitHub Desktop.
Save nathakits/90cd237f178e053b587b84235c8553ff to your computer and use it in GitHub Desktop.
NPM Cheatsheet

NPM Cheatsheet

Create package.json: npm init -y

Install package & save in dependencies: npm i -S <insert_name_of_package_here>

Install package & save in devDependencies: npm i -D <insert_name_of_package_here>

Install package globally: npm i <insert_name_of_package_here> -g

Uninstall package: npm r <insert_name_of_package_here>

Uninstall global package: npm r <insert_name_of_package_here> -g

Uninstall package & remove from dependencies: npm r -S <insert_name_of_package_here>

Uninstall package & remove from devDependecies: npm r -D <insert_name_of_package_here>

Run Script: node <name_of_script>

Check for outdated packages: npm outdated

Get list of installed packages: npm ls

Go to package rep0: npm repo <insert_name_of_package_here>

Go to package website: npm home <insert_name_of_package_here>

Check version of package: npm view <insert_name_of_package_here> version

Check if packages are installed in package.json: npm prune

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment