G
G
gomerIT2020-12-07 23:58:26
npm
gomerIT, 2020-12-07 23:58:26

NPM Difference between dep and devDep. Where to install eslint, prettier?

Hello, if I'm not mistaken,

dependencies
it is set that when building (result) will be used in the project, and with the prefix
dev
, then what is used for development, right? I think it's better to install eslint and prettier in a section
devDependencies
. But I'm reading a guide for installing these modules, and the author uses
-d
, which is respectively set in
dependencies
and this is where I confused myself. Maybe I'm wrong and prettier with eslint needs to be installed in the section
dependencies

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Glebov, 2020-12-08
@SkiperX

`npm install` saves any specified packages into `dependencies` by default.
Additionally, you can control where and how they get saved with some
additional flags:
* `-P, --save-prod`: Package will appear in your `dependencies`. This is the
default unless `-D` or `-O` are present.
* `-D, --save-dev`: Package will appear in your `devDependencies`.
* `-O, --save-optional`: Package will appear in your `optionalDependencies`.
* `--no-save`: Prevents saving to `dependencies`.

https://docs.npmjs.com/cli/v6/commands/npm-install

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question