fossa-cli icon indicating copy to clipboard operation
fossa-cli copied to clipboard

npm workspaces are not supported properly

Open zenonhun opened this issue 3 years ago • 5 comments

Env: Nodjes 16.x + Npm 8.x The repository is a monorepo with multiple npm projects. The root npm project is configured to use workspaces, so only the root project has a package-lock.json file, the sub projects has only package.json files. Due to the workspaces feature some dependencies are installed into the root node_modules, others into the sub projects' node_modules.

After running fossa analyze, the result is mixed. It contains some deep dependencies as direct dependency, and some deep dependencies are not reported at all.

zenonhun avatar Feb 17 '22 21:02 zenonhun

Based on the report the deep dependencies of the sub-projects are not properly analyzed. The sub projects has only a package.json and only 1-2 modules in the node_modules, all other dependecny are installed in the root, and reported in the root package-lock.json.

zenonhun avatar Feb 17 '22 22:02 zenonhun

Hi @zenonhun, we recently added a few fixes for scanning NPM projects that touched on how we handled workspaces as well. Can you try rescanning this project with the latest version of the FOSSA CLI and let us know how if the issue you see persists?

zlav avatar May 11 '22 02:05 zlav

Hi @zlav, it is imporved, but still there is an issue. Now I had time to create a minimalistic setup:

test-ws.zip

In this example there is a root project and a sub project. And depending on if the root project has some devdependency, the result changes.

In this example the "winston" dependency has a deep-dependency called "kuler". And it is found or not found depending on the root projects devDependencies.

So issuing the command: "fossa analyze --output | grep kuler" has different result. However it shouldn't.

And it is not the only missing dependency, just an example.

Using node 16.15.0, npm 8.5.5. Fossa 3.2.15.

zenonhun avatar May 12 '22 09:05 zenonhun

I am seeing the same issue. I cannot get fossa list-targets to pick up all the workspaces and if I target them directly the yarn.lock file will be missing and it will fail. Is there a workaround for this?

node: v16 fossa-cli: 3.6.4

martina-if avatar Nov 21 '22 18:11 martina-if

@zlav can you confirm this is fixed or should be closed?

thernstig avatar Feb 11 '23 08:02 thernstig