Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 302 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find the version of an installed npm package

#1
How can I find the version of an installed Node.js or npm **package**?

This prints the version of npm itself:

npm -v <package-name>

This prints a cryptic error:

npm version <package-name>

This prints the package version *on the registry* (i.e., the latest version available):

npm view <package-name> version

How do I get the **installed version**?


Reply

#2
To see all the installed packages locally or globally, use these commands:

1. `npm list` for local packages or `npm list -g` for globally installed packages.
2. `npm list --depth=0`
3. `npm list | sls <package name>`
4. `node -v`
Reply

#3
You may try this:
```npm show {package} version``` shows the latest package version.
And if your package is outdated, ```npm outdated``` will show it with version info.
Reply

#4
You can also check the version with this command:

`npm info <package name> version`
Reply

#5
To list local packages with the version number use:

```npm ls --depth=0```

To list global packages with the version number use:

```npm ls -g --depth=0```
Reply

#6
**npm list package-name** gives the currently installed version
Reply

#7
Just check your package.json file.

"dependencies": {
"ajv": "^8.9.0",
"ajv-keywords": "^5.1.0",
"fastify": "^3.27.0"
Reply

#8
Another quick way of finding out what packages are installed **locally** and **without their dependencies** is to use:

```lang-none
npm list --depth=0
```

Which gives you something like

```lang-none
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
```

Obviously, the same can be done globally with `npm list -g --depth=0`.

This method is clearer if you have installed a lot of packages.

To find out which packages need to be updated, you can use `npm outdated -g --depth=0`.
Reply

#9
`npm view <package> version` - returns the latest available version on the package.

`npm list --depth=0` - returns versions of all installed modules without dependencies.

`npm list` - returns versions of all modules and dependencies.

And lastly to get the Node.js version: `node -v`

Reply

#10
Use `npm list` for local packages or `npm list -g` for globally installed packages.

You can find the version of a specific package by passing its name as an argument. For example, `npm list grunt` will result in:

```lang-none
projectName@projectVersion /path/to/project/folder
└── [email protected]
```

Alternatively, you can just run `npm list` without passing a package name as an argument to see the versions of all your packages:

```lang-none
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ └── [email protected]
└── [email protected]
```

You can also add `--depth=0` argument to list installed packages without their dependencies.


Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through