在运行项目的时候发现packag.json中"dependencies"和 "devDependencies"中依赖项的配置信息完全不同,如下图(以echarts举例),于是抱着好奇的心态去问了ChatGPT,不出所料,ChatGPT完美解答了我的疑问,GPT4.0就是这么强。
First, it explains
Generally speaking, the dependencies listed in"dependencies"
dependencies listed "devDependencies"
in
Then the solution is given
Supplement: View the version of a dependency installed in the project, but the ** package.json
file does not record the version information. The following two methods are introduced**
Method 1: Use the ** npm list
command **
Open a terminal in the project's root directory and run the following command:
npm list [依赖项名称]
For example, if you want to see echarts
the version of , run:
npm list echarts
This will show the version installed echarts
.
Method 2: Check the ** node_modules
folder **
Another way is to directly check node_modules
the folder to find the corresponding dependencies. Version information for a dependency is usually in a file in its subfolder package.json
.
- Navigate to the project's
node_modules
folder. - Find the dependencies folder for which you want to view version information.
- Open that folder and find
package.json
the file. - In
package.json
the file, findversion
the field. Version information for that dependency will be displayed here.
For example, for echarts
, in node_modules/echarts/package.json
the file you can find version information.
ps: version information explanation