nx: 15.8.1 build failure on cross-platform development teams or CI/Docker pipelines

Current Behavior

dependency installs fails due to inability to find module '@nrwl/nx-linux-x64-musl' in docker containers/pipelines.

Expected Behavior

Nx projects should install and build with same dependencies locally as in pipeline containers so dependencies can be frozen for change control/auditing purposes.

GitHub Repo

No response

Steps to Reproduce

  1. Develop on mac or windows
  2. install dependencies
  3. run yarn install --ignore-optional --ignore-scripts --silent --frozen-lockfile in a docker container

Nx Report

>  NX   Report complete - copy this into the issue template

   Node : 18.12.1
   OS   : darwin arm64
   yarn : 1.22.19
   
   nx                      : 15.8.1
   @nrwl/js                : 15.8.1
   @nrwl/jest              : 15.8.1
   @nrwl/linter            : 15.8.1
   @nrwl/workspace         : 15.8.1
   @nrwl/cli               : 15.8.1
   @nrwl/cypress           : 15.8.1
   @nrwl/devkit            : 15.8.1
   @nrwl/eslint-plugin-nx  : 15.8.1
   @nrwl/node              : 15.8.1
   @nrwl/nx-plugin         : 15.8.1
   @nrwl/react             : 15.8.1
   @nrwl/rollup            : 15.8.1
   @nrwl/tao               : 15.8.1
   @nrwl/web               : 15.8.1
   @nrwl/webpack           : 15.8.1
   typescript              : 4.9.5
   ---------------------------------------
   Community plugins:
   @jscutlery/semver : 2.28.0
   ---------------------------------------
   Local workspace plugins:
         @my-project/nx

✨  Done in 1.24s.

Failure Logs

Step 9/16 : RUN yarn install --ignore-optional --ignore-scripts --silent --frozen-lockfile
 ---> Running in d5b6adb840d2
Removing intermediate container d5b6adb840d2
 ---> 5b36acfb8a4f
Step 10/16 : COPY . /app
 ---> c35c6da79680
Step 11/16 : RUN yarn nx build my-project
 ---> Running in c478b6c3918e
yarn run v1.22.19
$ /app/node_modules/.bin/nx build my-project
 >  NX   Cannot find module '@nrwl/nx-linux-x64-musl'
   Require stack:
   - /app/node_modules/nx/src/native/index.js
   - /app/node_modules/nx/src/hasher/native-file-hasher.js
   - /app/node_modules/nx/src/hasher/file-hasher.js
   - /app/node_modules/nx/src/project-graph/build-project-graph.js
   - /app/node_modules/nx/src/project-graph/project-graph.js
   - /app/node_modules/nx/src/utils/project-graph-utils.js
   - /app/node_modules/nx/src/tasks-runner/utils.js
   - /app/node_modules/nx/src/tasks-runner/run-command.js
   - /app/node_modules/nx/src/command-line/run-one.js
   - /app/node_modules/nx/src/command-line/nx-commands.js
   - /app/node_modules/nx/bin/init-local.js
   - /app/node_modules/nx/bin/nx.js
error Command failed with exit code 1.

Additional Information

This is probably related to the implementation of https://github.com/nrwl/nx/pull/15071, and may be a documentation issue, (no documentation was added for the

I am going to try setting NX_NON_NATIVE_HASHER=true in my docker/builds to see if this fixes, but i think there was a step missing in the design considerations for this feature.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 6
  • Comments: 31 (15 by maintainers)

Most upvoted comments

I was able to fix this by adding @nrwl/nx-linux-x64-gnu to my optional dependencies. That allowed it to be installed on CI, but not break the install in my local dev environment.

~Any updates? My team is using Intel and Apple Silicon macs and we are having the same problem.~ The issue has gone but I don’t know why 😞

Thank you @arrocke ! Yes, adding this to package.json helped:

"optionalDependencies": {
    "@nrwl/nx-linux-x64-musl": "^15.8.5"
  }

I am adding -x64-musl since this is apperatnly used on the alpine linux.

@Cammisuli is this a temporary fix or something that shall stay?

Hi, same problem here with pnpm v8, on a node:18-alpine3.16, any update?

@harmoney-franck could you please try node:18-alpine ?

Thank you @arrocke ! Yes, adding this to package.json helped:

"optionalDependencies": {
    "@nrwl/nx-linux-x64-musl": "^15.8.5"
  }

I am adding -x64-musl since this is apperatnly used on the alpine linux.

@Cammisuli is this a temporary fix or something that shall stay?

Your issue is most likely related to https://github.com/npm/cli/issues/4828

@pavelbinar it appears to be working for me…

Here’s what I did to build the image image

Then connecting to the instance, I can see the right packages in the @nrwl namespace in node_modules image