Categories
Archives

5 basic npm command tips

As a Node developer npm is your best friend. Or it should be your best friend, but as a beginner it can be difficult to get around it. It’s a complex system, with plenty of features and it can be intimidating to get a handle of everything. By learning a few tips and tricks, a few shortcuts, you can make your life a lot easier. That being said, let’s dive in and have a look at a few npm tips and tricks.

1 Outdated dependencies

This is a common issues for any type of registry, but there is a simple fix to it.

By running npm outdated in your project you will receive the current version, the version that you need and the latest version.

2 Clean cache

If you want to clear things out to resolve issues with a package, this option is very helpful

Run npm clean

Npm install

3 Help command

Very basic command, but one that can be of great help. Hence the name.

Run: npm help or npm -1 which will give you more information related to subcommands

4 npm version

If you’re not sure which version of npm you’re using you can find out easily with this command

Run: npm -v

If you want/need to update it you can with npm install -g npm

5 Start something new

You have something in mind for a new project? Or a new module that you want to build? Great.

Run npm init.

These are just a few basic tips that can help you get around npm move easily. There are a lot more tips and tricks, if you have any suggestions that other developers might benefit from, feel free to list them in the comment section.

Tweet