I'm building something with Webpack to transpile and bundle few JS files. However, I'd like to know which version I'm using.
我正在使用Webpack构建一些东西来转换并捆绑一些JS文件。但是,我想知道我正在使用哪个版本。
Let's suppose that I have the it installed globally. How would I do it without checking package.json
?
我们假设我在全球范围内安装了它。如果不检查package.json,我该怎么做?
2 个解决方案
#1
7
Due to my reputation, I am unable to comment. But quickly wanted to point out as suggested above in the right answer:
由于我的声誉,我无法发表评论。但很快就想在正确的答案中指出如上所述:
Alternate method:
npm view webpack version
npm查看webpack版本
will only show the latest webpack
that is available to download from the registry. It will not show the installed version.
将仅显示可从注册表下载的最新webpack。它不会显示已安装的版本。
(without dependencies)
For globally installed packages: npm list -g --depth=0
对于全局安装的软件包:npm list -g --depth = 0
For locally installed packages: npm list --depth=0
对于本地安装的软件包:npm list --depth = 0
(with dependencies)
For globally installed packages: npm list -g
对于全局安装的软件包:npm list -g
For locally installed packages: npm list
对于本地安装的软件包:npm list
Source: Find the version of an installed npm package
来源:查找已安装的npm软件包的版本
#2
4
Run npm list --depth=0
and you will see a list of global modules with version listed. They're in alphabetical order so you should see webpack
at the very end. In my case it reads webpack-core@1.14.0
.
运行npm list --depth = 0,您将看到列出版本的全局模块列表。它们按字母顺序排列,所以你应该在最后看到webpack。在我的例子中,它读取webpack-core@1.14.0。
#1
7
Due to my reputation, I am unable to comment. But quickly wanted to point out as suggested above in the right answer:
由于我的声誉,我无法发表评论。但很快就想在正确的答案中指出如上所述:
Alternate method:
npm view webpack version
npm查看webpack版本
will only show the latest webpack
that is available to download from the registry. It will not show the installed version.
将仅显示可从注册表下载的最新webpack。它不会显示已安装的版本。
(without dependencies)
For globally installed packages: npm list -g --depth=0
对于全局安装的软件包:npm list -g --depth = 0
For locally installed packages: npm list --depth=0
对于本地安装的软件包:npm list --depth = 0
(with dependencies)
For globally installed packages: npm list -g
对于全局安装的软件包:npm list -g
For locally installed packages: npm list
对于本地安装的软件包:npm list
Source: Find the version of an installed npm package
来源:查找已安装的npm软件包的版本
#2
4
Run npm list --depth=0
and you will see a list of global modules with version listed. They're in alphabetical order so you should see webpack
at the very end. In my case it reads webpack-core@1.14.0
.
运行npm list --depth = 0,您将看到列出版本的全局模块列表。它们按字母顺序排列,所以你应该在最后看到webpack。在我的例子中,它读取webpack-core@1.14.0。