Best way to install node packages

Just looking for a best practice tip.

What is the preferred or best way to go about installing node packages for perspective components?

I originally used the perspective-component SDK example from the IA GitHub and I have installed plenty of packages, but every time I install one with npm or yarn it seems I have to remove all node_modules folders from web/ web/package/client and web/package/designer then run yarn cache clean in web/ and then yarn --update-checksums before I can build again. Typically when I install a new node module I go to web/packages/client and run `npm install somepackage* but that appears to be my problem maybe?

I use the com.github.node-gradle.node plugin like the SDK example, but 1. disable the setup and install tasks:

tasks.nodeSetup {
    enabled = false
}
tasks.npmInstall {
    enabled = false
}

and 2. don’t treat the client and designer resources as separate packages, just separate outputs of the same build.

:man_shrugging:

Actually, your issue is probably workspace related.

The SDK example has the client and designer packages in separate workspaces.

1 Like