ui5-tooling: [ui5/cli] Failed to download ui5 packages when working behind proxy.

Expected Behavior

Download packages successfully.

Current Behavior

Now i’m working behind a http proxy in company. i have a .npmrc file to set the https-proxy and proxy.

In project level, i can run npm i and download the package successfully. But when i run npm run start -> ui5 serve -o index-dev.html --verbose, it will be failed when auto download the ui5 dependencies defined in ui5.yaml.

framework:
  name: SAPUI5
  version: "1.112.3"
  libraries:
    - name: sap.f
    - name: sap.m
    - name: sap.tnt
    - name: sap.ui.core
    - name: themelib_sap_horizon

Steps to Reproduce the Issue

  1. config https-proxy and proxy in .npmrc, and check npm config list
  2. npm i (success)
  3. run npm run start got
Error Message:
Resolution of framework libraries failed with errors:
Failed to resolve library sap.f: No matching version found for @openui5/sap.f@1.113.0.
Failed to resolve library sap.m: No matching version found for @openui5/sap.m@1.113.0.
Failed to resolve library sap.ui.core: No matching version found for @openui5/sap.ui.core@1.113.0.
Failed to resolve library themelib_sap_fiori_3: No matching version found for @openui5/themelib_sap_fiori_3@1.113.0.
  1. run ui5 serve --verbose got
...
verb ui5Framework:npm:Registry Using npm configuration (extract):
verb ui5Framework:npm:Registry    registry: https://registry.npmjs.org/
verb ui5Framework:npm:Registry    proxy: http://xxxxxxxxx@xxxxxxxxx:xxxx/
verb ui5Framework:npm:Registry    globalconfig: C:\Program Files\nodejs\etc\npmrc
verb ui5Framework:npm:Registry    userconfig: C:\Users\zoi7sgh\.npmrc
verb ui5Framework:npm:Registry    cache: C:\Users\zoi7sgh\.ui5\framework\cacache
verb ui5Framework:npm:Registry    cwd: C:\Users\zoi7sgh\Documents\Project\test\openui5-sample-app
...
verb ui5Framework:npm:Installer Installing @openui5/sap.f in version 1.113.0 to C:\Users\zoi7sgh\.ui5\framework\staging\@openui5-sap.f-1.113.0...
...
verb ui5Framework:AbstractResolver Failed to process library sap.f
verb ui5Framework:AbstractResolver Error: No matching version found for @openui5/sap.f@1.113.0.
verb ui5Framework:AbstractResolver Call stack: @openui5/sap.f: No matching version found for @openui5/sap.f@1.113.0.
    at module.exports (C:\Users\zoi7sgh\Documents\Project\Test\openui5-sample-app\node_modules\@ui5\cli\node_modules\npm-pick-manifest\lib\index.js:209:23)
    at RegistryFetcher.manifest (C:\Users\zoi7sgh\Documents\Project\Test\openui5-sample-app\node_modules\@ui5\cli\node_modules\pacote\lib\registry.js:119:22)
    at async Installer.fetchPackageManifest (file:///C:/Users/zoi7sgh/Documents/Project/Test/openui5-sample-app/node_modules/@ui5/cli/node_modules/@ui5/project/lib/ui5Framework/npm/Installer.js:59:22)    at async file:///C:/Users/zoi7sgh/Documents/Project/Test/openui5-sample-app/node_modules/@ui5/cli/node_modules/@ui5/project/lib/ui5Framework/Openui5Resolver.js:44:29
    at async Promise.all (index 0)
    at async Openui5Resolver._processLibrary (file:///C:/Users/zoi7sgh/Documents/Project/Test/openui5-sample-app/node_modules/@ui5/cli/node_modules/@ui5/project/lib/ui5Framework/AbstractResolver.js:87:33)
    at async file:///C:/Users/zoi7sgh/Documents/Project/Test/openui5-sample-app/node_modules/@ui5/cli/node_modules/@ui5/project/lib/ui5Framework/AbstractResolver.js:112:5
    at async Promise.all (index 0)
    at async Openui5Resolver._processLibraries (file:///C:/Users/zoi7sgh/Documents/Project/Test/openui5-sample-app/node_modules/@ui5/cli/node_modules/@ui5/project/lib/ui5Framework/AbstractResolver.js:110:19)
    at async Openui5Resolver.install (file:///C:/Users/zoi7sgh/Documents/Project/Test/openui5-sample-app/node_modules/@ui5/cli/node_modules/@ui5/project/lib/ui5Framework/AbstractResolver.js:189:3)    
    at async Object.enrichProjectGraph (file:///C:/Users/zoi7sgh/Documents/Project/Test/openui5-sample-app/node_modules/@ui5/cli/node_modules/@ui5/project/lib/graph/helpers/ui5Framework.js:372:29)    
    at async graphFromPackageDependencies (file:///C:/Users/zoi7sgh/Documents/Project/Test/openui5-sample-app/node_modules/@ui5/cli/node_modules/@ui5/project/lib/graph/graph.js:73:3)
    at async serve.handler (file:///C:/Users/zoi7sgh/Documents/Project/Test/openui5-sample-app/node_modules/@ui5/cli/lib/cli/commands/serve.js:89:11)
...
⚠️  Process Failed With Error

  1. Go to non-proxy network and remove proxy in .npmrc, everything working well.

I think npm in ui5 cli not read the config in .npmrc.

Context

  • UI5 Module Version (output of ui5 --version when using the CLI): 3.0.7
  • Node.js Version: v18.16.0
  • npm Version: v9.5.1
  • OS/Platform: Windows 10 (also test in this docker/dev-environments-javascript with same config)

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (10 by maintainers)

Commits related to this issue

Most upvoted comments

The fix is included in @ui5/cli v3.1.1

Working well with v3.1.1. Thank you, team! 👍

Hi @flovogt I think we need keep this ticket open until the new release on npm. Now the latest version is still v3.1.0 which i guess not include this fix. (Still show error when use 3.1.0)

Hi @matz3 I have tested by using 3.0.0 which working well behind the proxy.

From the code, I noticed that we don’t pass the https-proxy to pacote: https://github.com/SAP/ui5-project/blob/0733cdaf18658897058a24ce1278c4051693dd51/lib/ui5Framework/npm/Registry.js#L71

However, there’s no public documentation on that option in pacote or npm-registry-fetch

We do pass the option but only log some options. I will debug to see why it is not picked up and compare it with how npm does it.