-
Notifications
You must be signed in to change notification settings - Fork 25
Updating or adding Packages
veeramarni edited this page Apr 10, 2020
·
10 revisions
- First, you need to delete root's
package-lock.json - Search for the package and add to the search box with replace value so the package is get updated in all the packages.json files if it used
- Run
npm install -ffrom the root. - Make sure none of the node_modules are installed under subdirectories of
packagesorservers. Look fornpm_modulesunder theservers\frontend-serveretc... to make sure no localnode_modulesare created.
If the package is not generic for the whole project then add it to the package.json of the package folder where it will be used. Two ways to do it.
i. Go to the package.json file under the module where you want to add the package and edit the file to add the package. After the package is added, run npm install or npm install -f from the root (not from the module location).
ii. Use the following lerna command to add the package.
You can use the following command.
$ lerna add --scope=<module> <package>[@version] [--dev] [--exact] [--peer]
Example
$ lerna add --scope=sample-stack-frontend-server apollo-link@^1.2.13
-- you can regex shortcut like below instead of giving full package name of module --
$ lerna add --scope=*frontend-server apollo-link@^1.2.13
You will see the package added to that module by checking its package.json