gpt4 book ai didi

node.js - Nodejs 将 package.json 中的依赖项从最新版本更新为已使用版本

转载 作者:太空宇宙 更新时间:2023-11-03 22:30:10 25 4
gpt4 key购买 nike

我使用 MEAN 堆栈创建了一个应用程序。

它在package.json应用程序中有很多依赖项。这是我的 package.json 文件的一个示例:

{
"name": "myapp",
"version": "1.0.0",
"description": "myapp",
"main": "server.js",
"author": {
"name": "sayed",
"email": ""
},"dependencies": {
"body-parser": "latest",
"compression": "latest",
"ejs": "^2.4.2",
"express": "latest",
"jsonwebtoken": "^7.0.0",
"method-override": "latest",
"mongodb": "^2.1.20",
"morgan": "latest",
"crypto": "latest"
}
}

现在我正在将我的应用程序部署到生产服务器并避免出现问题,我想在我开发的依赖项中保留相同的版本。

所以我需要一种方法将“最新”转换为我开发应用程序的特定版本。有什么命令可以这样做吗?或者我必须手动更改依赖项?

最佳答案

当我删除我的 node_modules 目录

npm update --save

帮助我更新package.json中的依赖项版本

关于node.js - Nodejs 将 package.json 中的依赖项从最新版本更新为已使用版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38260251/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com