geeklearningio / gl-vsts-tasks-yarn

Yarn Package Manager Visual Studio Team Services Build and Release Management extensions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

401: Unauthorized during native build

vascofg opened this issue · comments

Are you reporting a bug or a feature request ?

  • Bug
  • Feature request

Description

Using the yarn task with a private registry on TFS, it seems that the credentials are passed for the normal install phases but not for the last "native build" phase. This is on a Windows build agent.

Expected behavior

All requests to the private registries use the provided credentials.

Reproduction

  • Have "node": "10.15.1" as a dependency on your package.json, being downloaded from a private registry.
  • Try to run yarn on a Windows build agent
  • Installation of node-win-x64 fails with a 401 error.
2019-06-21T13:53:46.3396082Z [4/4] Building fresh packages...
2019-06-21T13:53:46.7248091Z verbose 126.353 
2019-06-21T13:53:46.7756626Z verbose 126.404 
2019-06-21T13:53:46.9770004Z verbose 126.605 Thanks for using Webpack!
2019-06-21T13:53:46.9770520Z                  Please consider donating to our Open Collective
2019-06-21T13:53:46.9770963Z                         to help us maintain this package.
2019-06-21T13:53:46.9771084Z 
2019-06-21T13:53:46.9771165Z 
2019-06-21T13:53:46.9771242Z 
2019-06-21T13:53:46.9771416Z                  Donate: https://opencollective.com/webpack/donate
2019-06-21T13:53:47.0195096Z verbose 126.647 info looking for cached prebuild @ C:\Users\a\AppData\Roaming\npm-cache\_prebuilds\c677a8-iltorb-v2.4.3-node-v64-win32-x64.tar.gz
2019-06-21T13:53:47.0195473Z info found cached prebuild 
2019-06-21T13:53:47.0195722Z info unpacking @ C:\Users\a\AppData\Roaming\npm-cache\_prebuilds\c677a8-iltorb-v2.4.3-node-v64-win32-x64.tar.gz
2019-06-21T13:53:47.0195986Z info unpack resolved to D:\Builds\_work\507\s\node_modules\iltorb\build\bindings\iltorb.node
2019-06-21T13:53:47.0196559Z info unpack required D:\Builds\_work\507\s\node_modules\iltorb\build\bindings\iltorb.node successfully
2019-06-21T13:53:47.0196776Z info install Successfully installed iltorb binary!
2019-06-21T13:53:47.8932307Z verbose 127.521 Cypress 3.3.0 is installed in C:\Users\a\AppData\Local\Cypress\Cache\3.3.0
2019-06-21T13:53:56.9083095Z verbose 136.536 gyp info it worked if it ends with ok
2019-06-21T13:53:56.9083441Z gyp info using node-gyp@3.8.0
2019-06-21T13:53:56.9083613Z gyp info using node@10.15.3 | win32 | x64
2019-06-21T13:53:56.9083864Z gyp info spawn C:\Python26\python.EXE
2019-06-21T13:53:56.9084089Z gyp info spawn args [ 'D:\\Builds\\_work\\507\\s\\node_modules\\node-gyp\\gyp\\gyp_main.py',
2019-06-21T13:53:56.9084291Z gyp info spawn args   'binding.gyp',
2019-06-21T13:53:56.9084475Z gyp info spawn args   '-f',
2019-06-21T13:53:56.9084627Z gyp info spawn args   'msvs',
2019-06-21T13:53:56.9084797Z gyp info spawn args   '-G',
2019-06-21T13:53:56.9084996Z gyp info spawn args   'msvs_version=2015',
2019-06-21T13:53:56.9085196Z gyp info spawn args   '-I',
2019-06-21T13:53:56.9085411Z gyp info spawn args   'D:\\Builds\\_work\\507\\s\\node_modules\\ttf2woff2\\build\\config.gypi',
2019-06-21T13:53:56.9085617Z gyp info spawn args   '-I',
2019-06-21T13:53:56.9085824Z gyp info spawn args   'D:\\Builds\\_work\\507\\s\\node_modules\\node-gyp\\addon.gypi',
2019-06-21T13:53:56.9086010Z gyp info spawn args   '-I',
2019-06-21T13:53:56.9086229Z gyp info spawn args   'C:\\Users\\a\\.node-gyp\\10.15.3\\include\\node\\common.gypi',
2019-06-21T13:53:56.9086442Z gyp info spawn args   '-Dlibrary=shared_library',
2019-06-21T13:53:56.9086634Z gyp info spawn args   '-Dvisibility=default',
2019-06-21T13:53:56.9086839Z gyp info spawn args   '-Dnode_root_dir=C:\\Users\\a\\.node-gyp\\10.15.3',
2019-06-21T13:53:56.9087072Z gyp info spawn args   '-Dnode_gyp_dir=D:\\Builds\\_work\\507\\s\\node_modules\\node-gyp',
2019-06-21T13:53:56.9087347Z gyp info spawn args   '-Dnode_lib_file=C:\\Users\\a\\.node-gyp\\10.15.3\\<(target_arch)\\node.lib',
2019-06-21T13:53:56.9087598Z gyp info spawn args   '-Dmodule_root_dir=D:\\Builds\\_work\\507\\s\\node_modules\\ttf2woff2',
2019-06-21T13:53:56.9087824Z gyp info spawn args   '-Dnode_engine=v8',
2019-06-21T13:53:56.9087991Z gyp info spawn args   '--depth=.',
2019-06-21T13:53:56.9088174Z gyp info spawn args   '--no-parallel',
2019-06-21T13:53:56.9088343Z gyp info spawn args   '--generator-output',
2019-06-21T13:53:56.9088541Z gyp info spawn args   'D:\\Builds\\_work\\507\\s\\node_modules\\ttf2woff2\\build',
2019-06-21T13:53:56.9088754Z gyp info spawn args   '-Goutput_dir=.' ]
2019-06-21T13:53:56.9088971Z gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe
2019-06-21T13:53:56.9089200Z gyp info spawn args [ 'build/binding.sln',
2019-06-21T13:53:56.9089372Z gyp info spawn args   '/clp:Verbosity=minimal',
2019-06-21T13:53:56.9089553Z gyp info spawn args   '/nologo',
2019-06-21T13:53:56.9089742Z gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
2019-06-21T13:53:56.9089902Z gyp info ok
2019-06-21T13:54:53.6902271Z verbose 193.319 Error: D:\Builds\_work\507\s\node_modules\node: Command failed.
2019-06-21T13:54:53.6902688Z Exit code: 1
2019-06-21T13:54:53.6902885Z Command: node installArchSpecificPackage
2019-06-21T13:54:53.6903042Z Arguments: 
2019-06-21T13:54:53.6903235Z Directory: D:\Builds\_work\507\s\node_modules\node
2019-06-21T13:54:53.6903442Z Output:
2019-06-21T13:54:53.6903595Z npm ERR! code E401
2019-06-21T13:54:53.6903757Z npm ERR! 401 Unauthorized: node-win-x64@10.15.1
2019-06-21T13:54:53.6903869Z 
2019-06-21T13:54:53.6904040Z npm ERR! A complete log of this run can be found in:
2019-06-21T13:54:53.6904264Z npm ERR!     C:\Users\a\AppData\Roaming\npm-cache\_logs\2019-06-21T13_53_48_612Z-debug.log
2019-06-21T13:54:53.6904489Z internal/modules/cjs/loader.js:584
2019-06-21T13:54:53.6904917Z     throw err;
2019-06-21T13:54:53.6905046Z     ^
2019-06-21T13:54:53.6905145Z 
2019-06-21T13:54:53.6905298Z Error: Cannot find module 'node-win-x64/package.json'
2019-06-21T13:54:53.6905987Z     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-06-21T13:54:53.6906222Z     at Function.resolve (internal/modules/cjs/helpers.js:30:19)
2019-06-21T13:54:53.6906457Z     at ChildProcess.<anonymous> (D:\Builds\_work\507\s\node_modules\node-bin-setup\index.js:18:27)
2019-06-21T13:54:53.6906684Z     at ChildProcess.emit (events.js:189:13)
2019-06-21T13:54:53.6906863Z     at maybeClose (internal/child_process.js:970:16)
2019-06-21T13:54:53.6907081Z     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
2019-06-21T13:54:53.6907307Z     at ChildProcess.proc.on (D:\Builds\_work\507\s\.yarn\releases\yarn-1.16.0.js:25292:15)
2019-06-21T13:54:53.6907528Z     at ChildProcess.emit (events.js:189:13)
2019-06-21T13:54:53.6907704Z     at maybeClose (internal/child_process.js:970:16)
2019-06-21T13:54:53.6907939Z     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
2019-06-21T13:54:53.6908146Z error D:\Builds\_work\507\s\node_modules\node: Command failed.
2019-06-21T13:54:53.6908322Z Exit code: 1
2019-06-21T13:54:53.6908498Z Command: node installArchSpecificPackage
2019-06-21T13:54:53.6908648Z Arguments: 
2019-06-21T13:54:53.6908826Z Directory: D:\Builds\_work\507\s\node_modules\node
2019-06-21T13:54:53.6909019Z Output:
2019-06-21T13:54:53.6909171Z npm ERR! code E401
2019-06-21T13:54:53.6909332Z npm ERR! 401 Unauthorized: node-win-x64@10.15.1
2019-06-21T13:54:53.6909440Z 
2019-06-21T13:54:53.6909607Z npm ERR! A complete log of this run can be found in:
2019-06-21T13:54:53.6909828Z npm ERR!     C:\Users\a\AppData\Roaming\npm-cache\_logs\2019-06-21T13_53_48_612Z-debug.log
2019-06-21T13:54:53.6910034Z internal/modules/cjs/loader.js:584
2019-06-21T13:54:53.6910201Z     throw err;
2019-06-21T13:54:53.6910329Z     ^
2019-06-21T13:54:53.6910418Z 
2019-06-21T13:54:53.6910589Z Error: Cannot find module 'node-win-x64/package.json'
2019-06-21T13:54:53.6910792Z     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
2019-06-21T13:54:53.6911035Z     at Function.resolve (internal/modules/cjs/helpers.js:30:19)
2019-06-21T13:54:53.6911257Z     at ChildProcess.<anonymous> (D:\Builds\_work\507\s\node_modules\node-bin-setup\index.js:18:27)
2019-06-21T13:54:53.6911480Z     at ChildProcess.emit (events.js:189:13)
2019-06-21T13:54:53.6911657Z     at maybeClose (internal/child_process.js:970:16)
2019-06-21T13:54:53.6911989Z     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
2019-06-21T13:54:53.6912217Z info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2019-06-21T13:54:53.7387572Z ##[error]Error: The process 'D:\Builds\_work\_tool\yarn\1.16.0\x64\yarn-v1.16.0\bin\yarn.cmd' failed with exit code 1
2019-06-21T13:54:53.7447337Z ##[section]Finishing: yarn

System information

VSTS or TFS:

  • VSTS
  • TFS

Agent:

  • Hosted
  • Custom

OS:

  • Windows
  • Mac
  • Linux

Yarn version:
1.16.0

Node version:
10.15.1

Hello,
I'm not sure what's going on with your gyp task. However if you are trying to install another version of node why not simply use Node Tools Installer Task rebuilding node on restore does not sound right.