raegen / nx

Github action for executing nx commands cached with @actions/cache
MIT License
3 stars 1 forks source link

The engine "node" is incompatible with this module. Expected version ">=20". Got "18.19.1" #36

Open mrfelton opened 7 months ago

mrfelton commented 7 months ago

I'm getting the following error when trying to use this on an ubuntu-latest runner:

changed 1 package in 765ms
yarn install v1.22.21
[1/5] Validating package.json...
error @raegen/nx@0.2.9: The engine "node" is incompatible with this module. Expected version ">=[20](https://github.com/me/mine/actions/runs/8040677385/job/21959053818#step:3:21)". Got "18.19.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
node:internal/errors:866
  const err = new Error(message);
              ^

Error: Command failed: yarn --cwd /home/runner/work/_actions/raegen/nx/4009bd9a711c0b58f79737945f17aa8caa2436c4/
    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at file:///home/runner/work/_actions/raegen/nx/4009bd9a711c0b58f79737945f17aa8caa2436c4/dist/setup.js:8:1
    at ModuleJob.run (node:internal/modules/esm/module_job:[21](https://github.com/me/mine/actions/runs/8040677385/job/21959053818#step:3:22)7:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:[24](https://github.com/me/mine/actions/runs/8040677385/job/21959053818#step:3:25))
    at async loadESM (node:internal/process/esm_loader:[34](https://github.com/me/mine/actions/runs/8040677385/job/21959053818#step:3:35):7)
    at async handleMainPromise (node:internal/modules/run_main:66:12) ***
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 1703,
  stdout: null,
  stderr: null
***

Node.js v20.8.1

I have this above the nx action

    - name: 'Install Node.js'
      uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # pin@v4.0.2
      with:
        node-version-file: '.nvmrc'

And an .nvmrc file with

20.11.1

It seems this package is trying to use node before the setup node action has a chance to run, so it only has an older version from the ubuntu-latest runner.

I've also tried running it on a custom runner that has a later version of node available. However, I get a different permissions error there:

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/yarn
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/yarn'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/yarn'] ***
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/yarn'
npm ERR! ***
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/[20](https://github.com/me/mine/actions/runs/8040649786/job/21958991948#step:3:21)24-02-25T20_44_51_938Z-debug-0.log
node:internal/errors:866
  const err = new Error(message);
              ^

Error: Command failed: sudo ln -sf "/home/runner/externals/node20/bin/node" /usr/bin/node && /home/runner/externals/node20/bin/npm install -g yarn
    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at file:///home/runner/_work/_actions/raegen/nx/4009bd9a711c0b58f79737945f17aa8caa2436c4/dist/setup.js:4:1
    at ModuleJob.run (node:internal/modules/esm/module_job:[21](https://github.com/me/mine/actions/runs/8040649786/job/21958991948#step:3:22)7:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:[24](https://github.com/me/mine/actions/runs/8040649786/job/21958991948#step:3:25))
    at async loadESM (node:internal/process/esm_loader:[34](https://github.com/me/mine/actions/runs/8040649786/job/21958991948#step:3:35):7)
    at async handleMainPromise (node:internal/modules/run_main:66:12) ***
  status: 2[43](https://github.com/me/mine/actions/runs/8040649786/job/21958991948#step:3:44),
  signal: null,
  output: [ null, null, null ],
  pid: 204,
  stdout: null,
  stderr: null
***

Node.js v20.8.1
raegen commented 3 months ago

Quite late to the party, my sincere apologies @mrfelton. Anyways, the latest version v0.3.5 should get around that. If you still have any inclination to use it obviously. Cheers