I’m trying to figure out how to see what version of a specific npm package I have installed on my system. I know there are different commands but they don’t give me what I need.
npm --version
This just shows me the npm version itself, not the package I want to check.
npm info express version
This command shows me the latest version available in the registry, but that’s not what I’m looking for either.
npm version express
When I try this approach, I get some weird error message that doesn’t help.
What I really need is to see the actual version that’s currently installed in my project or globally on my machine. Is there a proper way to do this? I’ve been searching around but can’t find the right command to get the installed version specifically.
To determine the version of an npm package that’s installed, check your project’s package.json file under the dependencies or devDependencies sections. This will show the version range specified in your project. However, to find the exact version that’s been installed, you can use the command npm show <package-name> version while in the project directory. Alternatively, you can navigate to the node_modules folder and open the package.json file of the specific package; it will display the precise version installed.
To check an npm package version, use npm list followed by the package name. For instance, npm list express will reveal the version of express installed locally in your project. If you’re looking for a globally installed package, simply add the -g flag: npm list -g express. Alternatively, npm ls express works in the same way. If you want only the version without any additional information, use npm ls express --depth=0. This approach is particularly useful when troubleshooting version-related issues.
just run npm outdated in your project folder and it’ll show you what’s currently installed vs available versions. way simpler than the other methods imo