rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[Rush] Intermittent issue of rush command failure (workaround exists)

Open ipip2005 opened this issue 4 years ago • 6 comments

Is this a feature or a bug?

  • [ ] Feature
  • [x] Bug

Please describe the actual behavior. Usually after a new rush version is out, when running rush install, it shows me error like below

The rush.json configuration requests Rush version 5.34.0-pr2172.0
Copying D:\GitRepos\sp-client-big\common\config\rush\.npmrc --> D:\GitRepos\sp-client-big\common\temp\install-run\@[email protected]\.npmrc
Installing @microsoft/rush...
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="https://pkgsprodwus21.pkgs.visualstudio.com/"

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\liaye\AppData\Roaming\npm-cache\_logs\2020-09-15T01_37_39_763Z-debug.log


Error: Unable to install package: Error: "npm install" encountered an error

If the issue is a bug, how can we reproduce it? Please provide detailed steps and include a GitHub branch if applicable. Your issue will get resolved faster if you can make it easy to investigate. It's intermittent to users. There is a small portion of folks in our team are reproducing this issue while other engineers don't have such issue.

What is the expected behavior? Rush install runs fine.

If this is a bug, please provide the tool version, Node.js version, and OS.

  • Tool:
  • Tool Version:
  • Node Version: v10.16.3
    • Is this a LTS version? No
    • Have you tested on a LTS version? No because our repo doesn't support Node >v12. However, a lot engineers using Node >=10.16.3 <11.0.0 don't have such issue.
  • OS: Window 10

Also attaching the debug log below:

0 info it worked if it ends with ok 1 verbose cli [ 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Users\liaye\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'install' ] 2 info using [email protected] 3 info using [email protected] 4 verbose npm-session a82dee62ecb6ed13 5 silly install runPreinstallTopLevelLifecycles 6 silly preinstall [email protected] 7 info lifecycle [email protected]~preinstall: [email protected] 8 silly install loadCurrentTree 9 silly install readLocalPackageData 10 timing stage:loadCurrentTree Completed in 7ms 11 silly install loadIdealTree 12 silly install cloneCurrentTreeToIdealTree 13 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms 14 silly install loadShrinkwrap 15 timing stage:loadIdealTree:loadShrinkwrap Completed in 1ms 16 silly install loadAllDepsIntoIdealTree 17 http fetch GET 401 https://onedrive.pkgs.visualstudio.com/_packaging/odsp-npm/npm/registry/@microsoft%2frush 94ms 18 silly fetchPackageMetaData error for @microsoft/[email protected] Unable to authenticate, need: Basic realm="https://pkgsprodwus21.pkgs.visualstudio.com/" 19 http fetch GET 401 https://onedrive.pkgs.visualstudio.com/_packaging/odsp-npm/npm/registry/@microsoft%2frush 27ms 20 silly fetchPackageMetaData error for @microsoft/[email protected] Unable to authenticate, need: Basic realm="https://pkgsprodwus21.pkgs.visualstudio.com/" 21 timing stage:rollbackFailedOptional Completed in 1ms 22 timing stage:runTopLevelLifecycles Completed in 160ms 23 silly saveTree [email protected] 24 verbose stack Error: Unable to authenticate, need: Basic realm="https://pkgsprodwus21.pkgs.visualstudio.com/" 24 verbose stack at res.buffer.catch.then.body (C:\Users\liaye\AppData\Roaming\npm\node_modules\npm\node_modules\npm-registry-fetch\check-response.js:94:17) 24 verbose stack at process._tickCallback (internal/process/next_tick.js:68:7) 25 verbose statusCode 401 26 verbose pkgid @microsoft/[email protected] 27 verbose cwd D:\GitRepos\sp-client-big\common\temp\install-run@[email protected] 28 verbose Windows_NT 10.0.19041 29 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\liaye\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" 30 verbose node v10.16.3 31 verbose npm v6.14.2 32 error code E401 33 error Unable to authenticate, need: Basic realm="https://pkgsprodwus21.pkgs.visualstudio.com/" 34 verbose exit [ 1, true ]

ipip2005 avatar Sep 15 '20 01:09 ipip2005

Are people's auth tokens expiring?

The convention is for individual users to have their auth tokens in a <home folder>/.npmrc file. It looks like you're using the Azure DevOps package feed. If your users are using better-vsts-npm-auth, the auth tokens expire very quickly.

iclanton avatar Sep 21 '20 17:09 iclanton

I don't think the auth tokens expired. I can workaround the issue by copying the .npmrc from my user folder to replace the one in the repo folder D:\GitRepos\sp-client-big\common\config\rush.npmrc

Then it can successfully install rush. After that, reverting the .npmrc change, rush install can still work without an issue.

It's only an issue when installing rush when there is a new version comes

ipip2005 avatar Sep 22 '20 20:09 ipip2005

That's a strange issue. Since you're internal at Microsoft, I'll reach out to you internally so we can try to debug this in-person (/over screen share)

iclanton avatar Sep 25 '20 02:09 iclanton

@iclanton I have one member of our dev team who is hitting this exact same issue but the workaround @ipip2005 mentioned isn't working for us.

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

Starting "rush install"

Validating package manager shrinkwrap file.

Trying to acquire lock for pnpm-6.24.1
Acquired lock for pnpm-6.24.1
Installing pnpm version 6.24.1

Deleting old files from %userprofile%\.rush\node-v14.18.2\pnpm-6.24.1
Transforming %userprofile%\source\repos\ReactComponents\common\config\rush\.npmrc
--> "%userprofile%\.rush\node-v14.18.2\pnpm-6.24.1\.npmrc"

Running "npm install" in %userprofile%\.rush\node-v14.18.2\pnpm-6.24.1
npm ERR! code E401
npm ERR! Unable to authenticate, need: Bearer authorization_uri=https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47, Basic realm="https://pkgsprodeus21.pkgs.visualstudio.com/", TFS-Federated

npm ERR! A complete log of this run can be found in:
npm ERR! %userprofile%\AppData\Roaming\npm-cache\_logs\2022-01-04T07_17_07_849Z-debug.log

The command failed:
npm install
ERROR: Error: The command failed with exit code 1

We tried running vsts-npm-auth pointing at a number of different .npmrc files but cannot get past this. Any ideas? Happy to provide any additional info that could help here.

Abe-Froman avatar Jan 04 '22 07:01 Abe-Froman

We actually got this resolved by deleting the package-lock.json that was in the root of the repo. Maybe this information will help someone else down the road.

Abe-Froman avatar Jan 04 '22 19:01 Abe-Froman

I'm having the same issue with two differences:

  • I'm on a MacOS
  • I don't have a package-lock.json in my root mono-repository

Additionally, publishing works fine if I use rush for bumping and then publishing with pnpm publish so this still seems to indicate an issue with Rush, imho.

awentzel avatar Jun 15 '22 19:06 awentzel