What is the difference between --save and --save-dev?

后端 未结 13 838
旧巷少年郎
旧巷少年郎 2020-11-28 00:02

What is the difference between:

npm install [package_name]

and:

npm install [package_name] --save

and:

13条回答
  •  感情败类
    2020-11-28 00:39

    --save-dev is used for modules used in development of the application,not require while running it in production envionment --save is used to add it in package.json and it is required for running of the application.

    Example: express,body-parser,lodash,helmet,mysql all these are used while running the application use --save to put in dependencies while mocha,istanbul,chai,sonarqube-scanner all are used during development ,so put those in dev-dependencies .

    npm link or npm install will also install the dev-dependency modules along with dependency modules in your project folder

提交回复
热议问题