2016-09-19 63 views
0

我正在開發一個web應用程序並使用grunt來管理任務。 這是我正在使用的package.json文件。現在我需要爲此應用程序包含express和mongodb模式。爲模型和數據庫模式添加express和Mongo

使用npm install express和npm安裝mongoose,是否所有依賴項都會自動安裝或者應該使用單個命令?

幫我解決這個問題。謝謝。

{ 
    "name": "square", 
    "version": "3.1.0", 
    "devDependencies": { 
    "connect-livereload": "~0.5.2", 
    "grunt": "~0.4.5", 
    "grunt-autoprefixer": "~3.0.0", 
    "grunt-concurrent": "~2.1.0", 
    "grunt-contrib-clean": "~0.7.0", 
    "grunt-contrib-coffee": "~0.13.0", 
    "grunt-contrib-compass": "~1.0.0", 
    "grunt-contrib-concat": "~0.5.0", 
    "grunt-contrib-connect": "^0.11.2", 
    "grunt-contrib-copy": "~0.8.0", 
    "grunt-contrib-cssmin": "~0.14.0", 
    "grunt-contrib-htmlmin": "~0.6.0", 
    "grunt-contrib-jade": "~0.15.0", 
    "grunt-contrib-jshint": "~0.11.0", 
    "grunt-contrib-less": "~1.1.0", 
    "grunt-contrib-uglify": "~0.11.0", 
    "grunt-contrib-watch": "~0.6.1", 
    "grunt-injector": "^0.6.1", 
    "grunt-open": "~0.2.3", 
    "grunt-usemin": "~3.1.0", 
    "jshint-stylish": "^2.1.0", 
    "load-grunt-tasks": "~3.4.0", 
    "time-grunt": "~1.3.0", 
    "serve-static": "^1.10.0", 
    "http-errors": "^1.3.1", 
    "debug": "^2.2.0", 
    "depd": "^1.1.0", 
    "destroy": "^1.0.3", 
    "range-parser": "^1.0.3", 
    "mime": "^1.3.4", 
    "fresh": "^0.3.0", 
    "etag": "^1.7.0", 
    "ms": "^0.7.1", 
    "on-finished": "^2.3.0", 
    "statuses": "^1.2.1"  
    }, 
    "engines": { 
    "node": ">=0.10.0" 
    } 
} 

回答

0

您可以使用

npm install express --save-dev 
npm install mongoose --save-dev 

這將節省您devDepencies列表中的package.json文件。當你安裝每個需求時,任何表達或不需要的依賴都會自動安裝。

0

使用以下命令:

npm install express --save 
npm install mongoose --save 

這將安裝所有依存關係的package.json,如果你想在其他系統上安裝它們,你可以使用

npm install 

這將安裝所提到的所有的依賴在package.json中。