Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors during CI execution caused by different environments #16262

Closed
guiseek opened this issue Apr 12, 2023 · 3 comments
Closed

Errors during CI execution caused by different environments #16262

guiseek opened this issue Apr 12, 2023 · 3 comments
Labels

Comments

@guiseek
Copy link
Contributor

guiseek commented Apr 12, 2023

Current Behavior

Errors during CI execution caused by different environments

While running on CI Github Actions I'm having issues with NX I can't find module '@nrwl/nx-linux-x64-gnu'

Expected Behavior

Running the integration tasks proceeds exactly as they are running locally, as all versions are equalized:

CI (Github Action)

Operating System
   ubuntu
   22.04.2
   LTS
environment details
   node: v18.15.0
   npm: 9.5.0
   yarn: 1.22.19

Local

    Node: 18.15.0
    OS: darwinarm64
    npm: 9.5.0

I tried to add it as a devDependency but I can't, because I use macOS and I get an error from npm

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for @nrwl/[email protected]: wanted {"os":"linux","arch":"x64"} (current: {"os":"darwin"," arch":"arm64"})
npm ERR! notsup Valid OS: linux
npm ERR! notsup Valid Arch: x64
npm ERR! notsup Actual OS: darwin
npm ERR! notsup Actual Arch: arm64

GitHub Repo

https://github.com/guiseek/nx-plugin

Steps to Reproduce

  1. Configure execution with
name: Pull Request

on: pull_request

env:
   CI: true

jobs:
   check:
     name: checklist
     if: "!contains(github.event.head_commit.message, 'skip ci')"
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v3
         with:
           ref: ${{ github.event.pull_request.head.sha }}
           fetch-depth: 0

       - uses: actions/setup-node@v3
         with:
           node-version: 18.15.0
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

       - name: Install Dependencies
         run: npm ci

       - name: Affected Tests
         run: npx nx affected:test

       - name: Affected Build
         run: npx nx affected:build

       - name: Affected Release
         run: npx nx affected:release

Trigger execution of tasks

Nx Report

➜  nx-plugin git:(fix-ci) ✗ nx report

 >  NX   Report complete - copy this into the issue template

   Node : 18.15.0
   OS   : darwin arm64
   npm  : 9.5.0
   
   nx (global)             : 15.9.2
   nx                      : 15.9.2
   @nrwl/js                : 15.9.2
   @nrwl/jest              : 15.9.2
   @nrwl/linter            : 15.9.2
   @nrwl/workspace         : 15.9.2
   @nrwl/angular           : 15.9.2
   @nrwl/cli               : 15.9.2
   @nrwl/cypress           : 15.9.2
   @nrwl/devkit            : 15.9.2
   @nrwl/eslint-plugin-nx  : 15.9.2
   @nrwl/nest              : 15.9.2
   @nrwl/node              : 15.9.2
   @nrwl/nx-plugin         : 15.9.2
   @nrwl/tao               : 15.9.2
   @nrwl/webpack           : 15.9.2
   @nrwl/nx-cloud          : 15.3.5
   typescript              : 4.9.5
   ---------------------------------------
   Community plugins:
   @guiseek/tool-release : 0.0.1
   @nx-plugin/release    : 1.3.0
   ---------------------------------------
   Local workspace plugins:
         @nx-plugin/angular
         @nx-plugin/release
         @nx-plugin/nest

Failure Logs

>  NX   Cannot find module '@nrwl/nx-linux-x64-gnu'

   Require stack:
   - /home/runner/work/nx-plugin/nx-plugin/node_modules/nx/src/native/index.js
   - /home/runner/work/nx-plugin/nx-plugin/node_modules/nx/src/hasher/native-file-hasher.js
   - /home/runner/work/nx-plugin/nx-plugin/node_modules/nx/src/hasher/file-hasher.js
   - /home/runner/work/nx-plugin/nx-plugin/node_modules/nx/src/project-graph/build-project-graph.js
   - /home/runner/work/nx-plugin/nx-plugin/node_modules/nx/src/project-graph/project-graph.js
   - /home/runner/work/nx-plugin/nx-plugin/node_modules/nx/src/project-graph/file-utils.js
   - /home/runner/work/nx-plugin/nx-plugin/node_modules/nx/src/command-line/affected.js
   - /home/runner/work/nx-plugin/nx-plugin/node_modules/nx/src/command-line/nx-commands.js
   - /home/runner/work/nx-plugin/nx-plugin/node_modules/nx/bin/init-local.js
   - /home/runner/work/nx-plugin/nx-plugin/node_modules/nx/bin/nx.js

Additional Information

Actually, I didn't know about the existence of the '@nrwl/nx-linux-x64-gnu' package, shouldn't it be a peerDependency of the official packages?

Any idea of a solution for this case? Has anyone reported something similar?

@FrozenPandaz FrozenPandaz added the scope: core core nx functionality label Apr 12, 2023
@Cammisuli
Copy link
Member

It looks like the package-lock.json wasnt generated properly. There should've been more optional dependencies included in the package-lock that doesnt look like it made it in.

It's an issue with npm noted here: npm/cli#4828

And the workaround is to delete the node_modules + package-lock.json and doing a npm install again.

You can confirm that it's correct if there are multiple @nrwl/nx-* packages, like @nrwl/nx-darwin-arm64, @nrwl/nx-linux-x64-gnu etc

@Cammisuli
Copy link
Member

closing in favour of the original post #15380

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants