4

my team is migrating to rush and I had a problem while setting it up: I'm getting a weird error when trying to add any 3rd party lib (let's say react) to package.json using rush add --package react (for example). The error log:

Found configuration in /home/ivan/dev/JS/eisbuk/rush.json

Rush Multi-Project Build Tool 5.66.2 - https://rushjs.io
Node.js version is 14.19.0 (LTS)

Found configuration in /home/ivan/dev/JS/eisbuk/rush.json

Starting "rush add"

Determining new version for dependency: react
No version selector was specified, so the version will be determined automatically.

Trying to acquire lock for pnpm-6.32.3
Acquired lock for pnpm-6.32.3
Found pnpm version 6.32.3 in /home/ivan/.rush/node-v14.19.0/pnpm-6.32.3

Symlinking "/home/ivan/dev/JS/eisbuk/common/temp/pnpm-local" --> "/home/ivan/.rush/node-v14.19.0/pnpm-6.32.3"
The "ensureConsistentVersions" policy is NOT active, so we will assign the latest version.

Querying NPM registry for latest version of "react"...

ERROR: The command failed with exit code 243

I tried to find a similar problem report related to rush and looked up the 243 error with npm, both to no avail. I'm using pnpm, however, the error persists with npm and yarn all the same (with yarn it's exit code 1, everything else is the same).

Here's my .npmrc (a default really):

registry=https://registry.npmjs.org/
always-auth=false

Interestingly enough, if I manually add a dependency to package.json and run rush update, the update goes well and the dep is added to node_modules and shrinkwrap (so it shouldn't be an npm registry problem). Here's my rush.json:

{
  "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json",
  "rushVersion": "5.66.2",
  "pnpmVersion": "6.32.3",
  "pnpmOptions": {
    "preventManualShrinkwrapChanges": true,
    "useWorkspaces": true
  },
  "nodeSupportedVersionRange": ">=12.13.0 <13.0.0 || >=14.15.0 <15.0.0 || >=16.13.0 <17.0.0",
  "gitPolicy": {},
  "repository": {},
  "eventHooks": {
    "preRushInstall": [],
    "postRushInstall": [],
    "preRushBuild": [],
    "postRushBuild": []
  },
  "variants": [],
  "projects": [
    /** ...other projects */
    {
      "packageName": "@eisbuk/functions",
      "projectFolder": "packages/functions"
    }
    /** ...other projects */
  ]
}

The entire repo can be found at: https://github.com/eisbuk/EisBuk/tree/feature/rush

ikusteu
  • 121
  • 1
  • 1
  • 5

1 Answers1

7

Solved!

In the end, I've managed to pinpoint it to the node version. I was using v14.19.0 and bumping to v16.14.2 solved it. I don't know if it's a known incompatibility, but here it is.

ikusteu
  • 121
  • 1
  • 1
  • 5
  • 2
    I too was getting this `exit code 243`, in my case it was when running `npm test`, and it provided no other errors. Additionally it was running on node `v16.15.0`. I changed it to `v16.14.2` and it started working. – Jeff Jun 16 '22 at 13:35
  • Wow was troubleshooting this for 2 days and finally found this thread! Same issue with `v16.17.0`, downgrading to `16.14.2` got it to work too! – TiHuan Aug 19 '22 at 20:20
  • That is a workaround, but not a solution. Nobody has a solution for this issue? – Palo Aug 31 '22 at 09:38
  • Solved for me: In my case the problem was that npm was started with a user that does not have a home directory. This probably happened in upgrade from 16.15.0 to 16.15.1. I read somewhere. Node wants to create cache or something similar in there. When changed to start with a different user that has a home directory, everything worked again. – Palo Aug 31 '22 at 10:00
  • 1
    @Palo, can you explain more? How do you create a user with a home, and how do you start with that user? – Anh Cao Sep 01 '22 at 09:10
  • @AnhCao I mean Linux environment. There it is possible to create a user that has no home directory, or better say whose home directory is not writable. That causes problems. – Palo Sep 01 '22 at 23:35
  • 1
    It was indeed a user issue for me. I'm running in a docker container and setting my docker-compose.yml to run commands as user node instead of root fixed the issue. Thanks @Palo – Rob Middleton Sep 04 '22 at 21:57
  • 1
    I hit a similar issue; I found that the default user in our container environment was node/1000 however the HOME environment variable was set to `/root`, which upset npm. – Lethargy Sep 07 '22 at 08:38