microsoft/rushstack

[rush] Using install throw "??=" error

jackerjay opened this issue · 6 comments

Summary

Expected: Install all dependencies successfully
Action: Just use rush install for install all dependencies
Wrong: We got Internal Error: Error loading rush plugin

Repro steps

Expected result: Install all dependencies successfully

Actual result: ERROR: Internal Error: Error loading rush plugin from .. node_modules/@rushstack/rush-azure-storage-build-cache-plugin/lib/index.js": SyntaxError: Unexpected token '??='

Details

The configuration of our repo has not changed at all, the current error started to appear on the afternoon of March 14th.
We find out a same issue #28918 in Azure/azure-sdk-for-js

Even though @rushstack/rush-azure-storage-build-cache-plugin is actually careful enough to only require patch updates from @azure/identity:

"dependencies": {
    "@azure/identity": "~2.1.0",
    ...
  }

But @azure/identity here is more permissive:
https://github.com/Azure/azure-sdk-for-js/blob/8ec4dab324f203aabca744fb07d9be2e3ca27e58/sdk/identity/identity/package.json#L112

"dependencies": {
    "@azure/core-rest-pipeline": "^1.1.0"
   ...
}

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? 5.93.2
rushVersion from rush.json? 5.93.0
useWorkspaces from rush.json? Yes
Operating system? Mac & Linux
Would you consider contributing a PR? No
Node.js version (node -v)? 14.21.3

We are also encountering this issue while publishing artifacts.

We are also facing this issue. However, the problem occurs only when we run the command rush change -b origin/main -v

@jackerjay @SarbajeetRoyTR The problem seems to impact node 14. I upgraded my setup to node 18 and all is back functional again!

@jackerjay @SarbajeetRoyTR The problem seems to impact node 14. I upgraded my setup to node 18 and all is back functional again!

Yes, upgrading the Node version is a solution (just upgrade to Node V16 will be OK) . However, this issue is caused by a dependency in rush-lib, and the situation we are facing is due to project issues, our Node version cannot be upgraded smoothly. So upgrading the Node version is not quite suitable for our project.

We have encountered the same issue. Is there any estimated time for fixing it?

Node 14 is no longer in support, so fixing this is out of scope for Rush. Node 14 went EOL a little less than a year ago (see https://github.com/nodejs/release?tab=readme-ov-file#end-of-life-releases).

If you do need to support Node 14, and as this issue is in the @azure/core-rest-pipeline, I'd recommend opening an issue there and asking that team to publish an update to their package. You can also consider checking in a lockfile for the install-run-rush.js script and setting the INSTALL_RUN_RUSH_LOCKFILE_PATH env when this script is invoked in CI.

I'd strongly recommend upgrading Node in your repo, as EOL versions of Node no longer get security updates.

The only potentially simple way to handle this for Rush would be to wrap the built-in cache plugin initializations in try-catch blocks and print a warning if one fails to load or initialize. We would probably take that fix, but we don't have any plans to implement it ourselves at this point. For that, consider opening a new issue. Keep in mind if you're using that plugin's functionality, in this case Azure Stroage build cache, that functionality won't work.