2

I have published a npm package to npm.

When I tried to install it anywhere through npm i <package-name>, It's installing all dependencies in it. How to install dev-dependencies of it, without navigating it to that directory.

The below are properties from published npm-package.

{
    "name":"test-package",
    "dependencies": {
       "pg":"^7.7.1"
    },
    "devDependencies": {
       "gremlin":"^3.3.3"
    }
}

My requirement is, when I type npm i test-package in my project location, I found pg in my node_modules directory, but when I run in development environment, I need gremlin also to be installed. How can I install npm-package along with all of its dependencies(dev also).

UKR
  • 163
  • 1
  • 14
  • Have you tried any of the answers/solutions to this [question](https://stackoverflow.com/questions/34700610/npm-install-wont-install-devdependencies)? _(Note: some answers are outdated)_ – RobC Dec 19 '18 at 10:19
  • I tried using `npm i test-package --dev` `npm i test-package --only=dev` But I'm unable to install devDependencies of that (test-package). – UKR Dec 19 '18 at 12:39

1 Answers1

-1

To install a package as a dev dependency you need to specify by using npm install <package-name> --save-dev. package.json