Skip to content

Building project graph on postinstall causes process to incorrectly exit with code 1 when libraries with individual project.json files are not yet present #9451

@markpeterfejes

Description

@markpeterfejes

Current Behavior

Building the project graph in the postinstall step breaks workspace dependency installation.

Expected Behavior

Even if an error occurs while building the project graph nx should not error and break the whole installation as stated here.
It seems this started to happen in v13 after this PR.

Steps to Reproduce

  1. Create a fresh nx repo.
  2. Create a couple of libraries with independent project.json files.
  3. Delete the libs folder and the node modules folder
  4. Try to install the dependencies of the repo.

After this it will say that the daemon couldn't finish the graph build, but in a docker container this will cause the whole installation to error out as per this condition

My suspicion is that despite that we are catching any errors in the init.ts, it will still stop the installation since we are exiting the process here.

The reason why the libraries are actually not there at the point of installation is that we are copying them in our Dockerfile after the installation step in order to take advantage of docker layer caching. (changing application code can still reuse the dependency-install layer of the workspace)

   Node : 16.14.0
   OS   : darwin x64
   yarn : 1.22.17

   nx : 13.9.2
   @nrwl/angular : 13.9.2
   @nrwl/cypress : 13.9.2
   @nrwl/detox : undefined
   @nrwl/devkit : 13.9.2
   @nrwl/eslint-plugin-nx : 13.9.2
   @nrwl/express : undefined
   @nrwl/jest : 13.9.2
   @nrwl/js : 13.9.2
   @nrwl/linter : 13.9.2
   @nrwl/nest : undefined
   @nrwl/next : undefined
   @nrwl/node : 13.9.2
   @nrwl/nx-cloud : 13.1.6
   @nrwl/nx-plugin : undefined
   @nrwl/react : undefined
   @nrwl/react-native : undefined
   @nrwl/schematics : undefined
   @nrwl/storybook : 13.9.2
   @nrwl/web : undefined
   @nrwl/workspace : 13.9.2
   typescript : 4.6.2
   rxjs : 7.5.5
   ---------------------------------------
   Community plugins:
   	 @ionic/angular: 6.0.12
   	 @ngrx/component: 13.0.2
   	 @ngrx/component-store: 13.0.2
   	 @ngrx/data: 13.0.2
   	 @ngrx/effects: 13.0.2
   	 @ngrx/entity: 13.0.2
   	 @ngrx/router-store: 13.0.2
   	 @ngrx/store: 13.0.2
   	 @ngrx/store-devtools: 13.0.2
   	 ts-node-builder: 2.2.0
   	 @funxtion/schematics: 0.0.1
   	 @ionic/cordova-builders: 6.1.0
   	 @ngrx/schematics: 13.0.2
   	 @nxtend/ionic-angular: 13.0.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions