N
InsightHorizon Digest

How can dev dependency be saved

Author

John Parsons

Updated on March 31, 2026

To add dependencies and devDependencies to a package. json file from the command line, you can install them in the root directory of your package using the –save-prod flag for dependencies (the default behavior of npm install ) or the –save-dev flag for devDependencies.

How do I save Dev dependencies?

To add dependencies and devDependencies to a package. json file from the command line, you can install them in the root directory of your package using the –save-prod flag for dependencies (the default behavior of npm install ) or the –save-dev flag for devDependencies.

Where are Dev dependencies stored?

Recall that development dependencies are stored in the devDependencies section of package. json , and have no impact on the running of your app. When installing modules as part of the CI/CD process to deploy your application, omit the dev dependencies by running: npm i –production.

When should a dev dependency be saved?

–save–save-devThe package installed is core dependency.The package installed is not a core rather development dependency.

What does -- save Dev means?

@YakovL save-dev means the packages are not installed when somebody else installs your package as their dependency. Packages that are only used to run scripts such as start/build will not be needed in that case, so they’re put in dev-dependencies.

Are Dev dependencies bundled?

From these answers I learned that dependencies are required to run the application while devDependencies are only required while developing (like unit tests). But how about this: My application depends on jQuery, but during a build step (with the help of my devDependencies ), everything is bundled into one file.

What are dev dependencies?

Dev dependencies are modules which are only required during development whereas dependencies are required at runtime. If you are deploying your application, dependencies has to be installed, or else your app simply will not work.

Why is TypeScript a dev dependency?

Installing as a dev dependency has a few benefits: It specifies which version of TypeScript did you use. In CI/CD pipeline, it is installed without a further instruction. The same is true with other developers working on your project.

Why do we use -- save Dev?

–save-dev adds the third-party package to the package’s development dependencies. It won’t be installed when someone runs npm install directly to install your package. It’s typically only installed if someone clones your source repository first and then runs npm install in it.

Why is -- save used?

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.

Article first time published on

What does save Dev flag do?

npm install <package_name> —save-dev updates the devDependencies in your package. These are only used for local testing and development.

How do I install dependencies?

Install the dependencies to the local node_modules folder. In global mode (ie, with -g or –global appended to the command), it installs the current package context (ie, the current working directory) as a global package. By default, npm install will install all modules listed as dependencies in package.

Is Lodash a dev dependency?

lodash as a module dependency (instead of devDependency) #96.

How do I install typescript globally?

  1. $ npm install typescript –save-dev //As dev dependency.
  2. $ npm install typescript -g //Install as a global module.
  3. $ npm install [email protected] -g //Install latest if you have an older version.

Is Webpack a dev dependency?

This approach considers that since your production app (aka the bundle you built with Webpack) can just run by itself, it means you have no production dependencies. Thus, all dependencies are devDependencies .

What is the purpose of NPM I -- save?

–save-exact or -E: This is an additional or optional command provided by the npm that will save the exact version of the installed packages which are configured at the time of development. It will not download the dependencies from npm’s default server range operator.

What is Dev dependency and dependency?

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. To save a dependency as a devDependency on installation we need to do an npm install –save-dev , instead of just an npm install –save.

Which dependencies should be Dev?

devDependencies should contain packages which are used during development or which are used to build your bundle, for example, mocha, jscs, grunt-contrib-watch, gulp-jade and etc.

What are the 3 types of dependencies?

  • Causal (logical) It is impossible to edit a text before it is written. …
  • Resource constraints. It is logically possible to paint four walls in a room simultaneously but there is only one painter.
  • Discretionary (preferential)

Are Dev dependencies used in production?

Development dependencies are intended as development-only packages, that are unneeded in production. For example testing packages, webpack or Babel. When you go in production, if you type npm install and the folder contains a package. json file, they are installed, as npm assumes this is a development deploy.

Do Dev dependencies matter?

2 Answers. devDependencies do not exclude the possibility that the dependency is required to make a bundle during build time –they are within the bundle that webpack generates for a website– but not required by the package/system that installs it for production: i.e. the server-package that installs the app-package.

Is react a dev-dependency?

According to NPM dependencies definition, the build dependency, react-scripts , should be a devDependency . However, it is in the dependencies section along with react and react-dom . In fact, react-scripts was a devDependency . For some practical reason, Facebook made it a dependency since react-scripts 1.0.

How do I install NPM globally?

Install Package Globally NPM installs global packages into /<User>/local/lib/node_modules folder. Apply -g in the install command to install package globally.

Does typescript need to be a dependency?

typescript , on the other hand, packages its declaration files, so there was no need for any additional dependencies. Our package exposes declarations from each of those, so any user of our browserify-typescript-extension package needs to have these dependencies as well.

Should types be installed as Dev dependency?

@types should definitely be devDependencies , you don’t want them installed when you npm i some-package , only when you clone the code and call npm i .

How do I create a Tsconfig file?

  1. install typescript yarn global add typescript.
  2. create a package. json: run yarn init or setting defaults yarn init -yp.
  3. create a tsconfig. json: run tsc –init.
  4. (*optional) add tslint. json.

What -- save means?

1 : to free or keep from danger or harm He saved a child from drowning. 2 : to keep from being ruined : preserve The group works to save the rain forests. 3 : to put aside for later use Save some milk for me. 4 : to keep money instead of spending it. 5 : to keep from being spent, wasted, or lost I’m saving my energy.

What is -- save in react?

–save mode is for packages that your app will use when it’s running, like React. –save-dev are for packages that help you develop like linters, module bundlers, transpilers (eg Babel).

Why do we not use -- save with NPM install anymore?

Packages installed without —save are not considered as dependencies and are kept separate. You can detect them easily as extraneous packages with npm ls and remove them instantly with npm prune . Now if you think extraneous packages are a bad thing, you can of course use –save everytime you install a new package.

Is Dotenv a dev dependency?

dotenv is a dev dependency. In production, keys are stored on the server whic…

Is Nodemon a dev dependency?

You can also install nodemon locally. When performing a local installation, you can install nodemon as a dev dependency with –save-dev (or –dev ).