Skip to content

[BUG] workspaces packages are built in parallel after npm ci even though they depend on each other #4475

Closed
@dreamorosi

Description

@dreamorosi

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

I'm using npm@8.5.2 and making use of the workspaces feature, my (simplified) project's structure is the following:

my_project
|_ packages
   |_ commons
   |_ logger
   |_ metrics
   |_ tracing
package.json 

In my package.json file I have the following config:

"workspaces": [
    "packages/*"
 ]

The project uses TypeScript and the packages logger, metrics, tracing all depend on commons.

When I run npm ci in my CI/CD environment (GitHub Actions) after installing the dependencies npm tries to build (tsc) the packages but appear to do so in parallel and so the build of all the dependant packages fails because it's being done before commons is ready.

Expected Behavior

Npm to understand that some packages of the workspace are dependant on others and build accordingly.

Alternatively to allow me to specify that I want to use a remote (i.e. not linked) version of the package even though the version number is the same as the local one.

Steps To Reproduce

Read above, also you can see the error (with logLevel == silly) here https://github.com/dreamorosi/aws-lambda-powertools-typescript/runs/5345787297?check_suite_focus=true#step:6:5380 (<- Line that causes the error)

Environment

  • npm: 8.5.2
  • Node.js: lts/fermium (aka 14.x)
  • OS Name: Ubuntu
  • System Model Name: GitHub Actions
  • npm config: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancementnew feature or improvementPriority 2secondary priority issueRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions