Adding package to sub packages or to servers or to devices
We use Lerna Hoisting feature. This makes sure the NPM package at most installed only once in the root node_modules
. However, we should not place npm dependency under root package.json
. The dependency should go under the package that needs it. For Example, if servers/backend-server
requires the package then the dependency should be added to its package.json
but not to the root package.json. Once added follow the below steps to install the package.
Run
npm run lerna
. This should automatically install the new npm package as it reads from all packages or serverspackage.json
.- If above one didn't work then install from the root without save option
npm i apollo-server@<version> --no-save