What is the --save option for npm install?

前端 未结 12 907
野性不改
野性不改 2020-11-22 13:54

I saw some tutorial where the command was:

npm install --save

What does the --save option mean?

Not able to find the a

12条回答
  •  眼角桃花
    2020-11-22 14:18

    Update as of 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:

    To add package in dependencies:

    npm install my_dep --save
    

    or

    npm install my_dep -S
    

    or

    npm i my_dep -S
    

    To add package in devDependencies

    npm install my_test_framework --save-dev
    

    or

    npm install my_test_framework -D
    

    or

    npm i my_test_framework -D
    

    package.json

提交回复
热议问题