1

Iam new to cypress wanted to know what is difference between npm install cypress vs npm install cypress --save-dev I googled but not finding any answers

Saeed
  • 5,413
  • 3
  • 26
  • 40
sumit goyal
  • 35
  • 1
  • 7
  • 2
    See [this related post](https://stackoverflow.com/questions/22891211/what-is-the-difference-between-save-and-save-dev?answertab=votes#tab-top) that describes the differences between the `--save` and `--save-dev` options. Note the `--save` option that is mentioned in that post is no longer necessary (_in earlier npm versions it was)_. You can now consider `npm install cypress` to be the same as `npm install cypress --save`. – RobC Sep 16 '21 at 09:29

3 Answers3

2

With npm install cypress, you are just installing cypress. with npm install --save-dev you are installing it as a dev dependency.

ItsNotAndy
  • 563
  • 5
  • 17
  • --Much thanks what do you mean by during development here is it dev environment ?? ? Iam running my cypress automation testcases so here will I will be using dependencies or devdependencies can you please help – sumit goyal Sep 16 '21 at 11:19
2

The difference between these two, is that devDependencies are modules which are only required during development, while dependencies are modules which are also required at runtime. src

Modules like Mochajs, cypress, jsdoc, etc are devDependencies, because they are useful just in develop Env and in Production Env We don't need them.

There are at least 2 different envs while developing, somewhere you develop and code and do some tests on your code(develop Env) and somewhere you deliver your product to your customer, which means you have tested your code completely and there is no need to run tests again(product).

You need some modules like cypress and mocha just for testing. In product env you don't need to test the product again. So you don't install extra modules!

So you need something like devDependencies in package manager to handle it for you.

Saeed
  • 5,413
  • 3
  • 26
  • 40
  • Saeed --Much thanks what do you mean by during development here is it dev environment >? ? Iam running my cypress automation testcases so here will I will be using dependencies or devdependencies can you please help – sumit goyal Sep 16 '21 at 11:19
  • I update my answer, Hope it helps. @sumitgoyal – Saeed Sep 16 '21 at 11:29
  • What if I use only dependencies word ?? what is difference then please tell – sumit goyal Sep 19 '21 at 14:08
  • You can install all your modules as dependency and not devDependency, the only difference is the packages you have to install while you're using that. But one of the good points of a module is the number of dependencies. Less dependencies means better. @sumitgoyal – Saeed Sep 19 '21 at 18:38
0

With the command npm install cypress you are installing the latest version of cypress in your system and you have to give this command through vs code terminal.

Fedor
  • 17,146
  • 13
  • 40
  • 131