在Express中,我如何将核心模块添加到我的package.json依赖项中,以便我可以在我的js文件中要求它们?

时间:2017-06-13 03:18:50

标签: javascript json node.js express git-bash

我试图使用核心模块' connect'并且,如果我正确理解了这种情况,那么express会在内部使用该模块。我想手动要求它,我已经尝试将它插入我的package.json文件中的依赖项中。也许我没有用我的git bash正确安装它?我在黑暗中拍摄,但这是我在文件中的依赖。

"dependencies": {
"connect": "2.4.2",
"accepts": "~1.3.3",
"array-flatten": "1.1.1",
"content-disposition": "0.5.2",
"content-type": "~1.0.2",
"cookie": "0.3.1",
"cookie-signature": "1.0.6",
"debug": "2.6.7",
"depd": "~1.1.0",
"encodeurl": "~1.0.1",
"escape-html": "~1.0.3",
"etag": "~1.8.0",
"finalhandler": "~1.0.3",
"fresh": "0.5.0",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "~2.3.0",
"parseurl": "~1.3.1",
"path-to-regexp": "0.1.7",
"proxy-addr": "~1.1.4",
"qs": "6.4.0",
"range-parser": "~1.2.0",
"send": "0.15.3",
"serve-static": "1.12.3",
"setprototypeof": "1.0.3",
"statuses": "~1.3.1",
"type-is": "~1.6.15",
"utils-merge": "1.0.0",
"vary": "~1.1.1"
}

1 个答案:

答案 0 :(得分:1)

要在package.json文件中保存依赖项,请执行

npm install connect --save