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

后端 未结 13 846
旧巷少年郎
旧巷少年郎 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:47

    All explanations here are great, but lacking a very important thing: How do you install production dependencies only? (without the development dependencies). We separate dependencies from devDependencies by using --save or --save-dev. To install all we use:

    npm i
    

    To install only production packages we should use:

    npm i --only=production
    

提交回复
热议问题