?yb? 2013-10-24 23:54 采纳率: 100%
浏览 2108
已采纳

Npm 安装的 -- save 选项是什么?

I saw some tutorial where the command was:

npm install --save

What does the --save option mean?

Not able to find the answer on Google.

转载于:https://stackoverflow.com/questions/19578796/what-is-the-save-option-for-npm-install

  • 写回答

10条回答 默认 最新

  • 零零乙 2013-10-24 23:56
    关注

    Update npm 5:

    As of npm 5.0.0, installed modules are added as a dependency by default, so the --save option is no longer needed. The other save options still exist and are listed in the documentation for npm install.

    Original answer:

    Before version 5, NPM simply installed a package under node_modules by default. When you were trying to install dependencies for your app/module, you would need to first install them, and then add them (along with the appropriate version number) to the dependencies section of your package.json.

    The --save option instructed NPM to include the package inside of the dependencies section of your package.json automatically, thus saving you an additional step.

    In addition, there are the complementary options --save-dev and --save-optional which save the package under devDependencies and optionalDependencies, respectively. This is useful when installing development-only packages, like grunt or your testing library.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(9条)

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!