在 package.json 文件中指定 dependencies 和 devDependencies

要指定您的项目所依赖的包,您必须在包的 package.json 文件中将它们列为 "dependencies""devDependencies"。当您(或其他用户)运行 npm install 时,npm 将下载 package.json 中列出的满足每个列出的 语义版本 要求的 dependencies 和 devDependencies。要查看将安装哪个版本的包,请使用 semver 计算器

To specify the packages your project depends on, you must list them as "dependencies" or "devDependencies" in your package's package.json file. When you (or another user) run npm install, npm will download dependencies and devDependencies that are listed in package.json that meet the semantic version requirements listed for each. To see which versions of a package will be installed, use the semver calculator.

  • "dependencies":您的应用程序在生产中所需的包。

    XfpDFazPE1ySw9iR1axNx6Fg5KMjUx0xQIdCBHgsM9pouWD8sf+x+NuHqyhFxM0qudEanqIH838SGIxkMv2XHLDV2LprcQOWC4GEt1Rbw7ycm/uQXgOZVBjPnSUdMKgf

  • "devDependencies":仅用于本地开发和测试的包。

    nDm7mlpuH90jCJjRF101VqOmKpvLFvRlgfK/H5u7JXupBXWmQCG7+riVbIvG85vilrAHvmXaMQaG6m0kGLQpv46RtKyvsL+gVYrKKA3tUMUsF5JgCop39Wosz3zVS5qfp/Zj66C/KPPo+zTe3bdc6Q==