Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

package-lock.json in npm workspaces

Tags:

npm

Given an npm workspace with the following structure

workspace
    package.json
    packages
        package-a
            package.json
        package-b
            package.json

When I run an install command in package-a this will generate a package-lock.json file in the root of the workspace but not in the package.json file itself.

Is there a way to also generate it in the packages?

like image 553
Arwed Mett Avatar asked Nov 23 '25 13:11

Arwed Mett


1 Answers

Yes, it is possible for example like this:

npm i emoji-picker-react -w packages/deepcase

This command updates packages/deepcase/package.json and package-lock.json in root folder.

(cd packages/deepcase && npm i --package-lock-only --workspaces false)

This command updates packages/deepcase/package-lock.json.

like image 159
Konard Avatar answered Nov 28 '25 00:11

Konard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!