在我的本地机器上,我在node.js应用程序上工作,我在初始化package.json之前安装了许多软件包。
当我使用:
初始化Package.json时 npm init
我得到了package.json,但它不包含node_modules中存在的所有依赖项,
当我搬到生产服务器(我运行npm install)时,这导致我丢失包的问题
有没有办法在依赖项部分中自动包含所有这些内容。
这是我的JSON文件:
{
"name": "xxxx",
"version": "1.0.0",
"description": "xxxxxxx",
"main": "server.js",
"dependencies": {
"date-utils": "^1.2.21",
"mssql": "^4.0.4",
"mysql": "^2.11.1",
"seriate": "^0.9.0",
"websocket": "^1.0.23",
"winston": "^2.2.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"repository": {
"type": "git",
"url": "git+https://gitlab.com/odot-web/hefner-socket.git"
},
"keywords": [
"nodejs",
"hefner",
"socket"
],
"author": "xxxx",
"license": "ISC",
"bugs": {
"url": "https://gitlab.com/odot-web/hefner-socket/issues"
},
"homepage": "https://gitlab.com/odot-web/hefner-socket#README"
}