cancel
Showing results for 
Search instead for 
Did you mean: 

Building of CAP project fails (npm registry sap/cds-dk)

DanielSchneider
Explorer
0 Kudos

Hi,

I wanted to re-build a successfully deployed cap project (after implementing small adjustments) but it fails now.

I'm using an mta.yaml file. Before I can deploy it, I have to build it: building fails.

To me it seems that SAP is currently adding/changing dependencies in the cds package.

I get the following error:

INFO executing the "npx -p @sap/cds-dk cds build --production" command...
........npm ERR! code E404
npm ERR! 404 Not Found - GET http://nginx-redirector.repo-cache.svc.cluster.local/repository/appstudio-npm-group/@sap/cds/-/cds-5...
npm ERR! 404 
npm ERR! 404  '@sap/cds@5.3.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of '@sap/cds-dk'
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Yesterday I got an error for a missing lint package, also noted as a dependency of sap/cds-dk. Since today that seems no problem anymore but now there is a different package missing, I'm concluding that SAP is currently working on dependencies of sap/cds-dk.

Can you please confirm and if I'm correct, when do you think everything will be 'buildable' again?

Thank you in advance

Daniel

Accepted Solutions (1)

Accepted Solutions (1)

Uwe_Klinger
Advisor
Advisor
0 Kudos

Hi Daniel,

Sorry, I needed to revise my answer after I saw that you use BAS.

"npx" always downloads the newest version. And new versions have just been released. At least that explains what have changed. But as said, for me it works both local and on BAS in the EU trial landscape (hanatrial.ondemand.com), which should be the same as EU10.

Looks like BAS' npm proxy doesn't resolve it for whatever reason.

Please open a ticket if the issue persists.

Maybe you can try a:

npm cache clean --force

Or go with the pre-installed @sap/cds-dk version (call without the npx) until the issue is resolved.

Best regards,

Uwe

DanielSchneider
Explorer
0 Kudos

Hi Uwe,

npm cache clean --force

unfortunately didn't help.

I'm not sure about calling it without 'npx': I actually just right click on the mta.yaml and choose 'Build MTA Project' - I guess everything else is then done automatically.

Since the change is not that urgent, I will wait a few days and open a ticket if the issue persists.

Thanks again for your quick replies!

Have a nice day & BR

Daniel

MohamedAharchi
Explorer

Using the pre-installed @sap/cds-dk version works for me!

dlwbolintoa
Discoverer
0 Kudos

Hi,

For anyone encountering this issue and needs a quick workaround, change the following line from mta.yaml, under commands of build-parameters:

- npx -p @sap/cds-dk cds build --production

To use the node_modules directory installed in your project:

- node_modules/@sap/cds-dk/bin/cds.js build --production
dlwbolintoa
Discoverer
0 Kudos

It seems this has already been fixed, no need for the workaround. Please see Boris' answer.

Answers (10)

Answers (10)

boris_tsirulnik
Participant

Hi,

It's is not recommended to change the default setting for npm registry manually.

BAS implements internal caching mechanism for NPM and Maven packages. The cache is updated every 24 hours with new package versions.

Following this thread we changed the cache update interval to 30 minutes and this problem should not occur anymore.

Best Regards,

Boris

Product Owner

Business Application Studio

erik_pross89
Explorer

This worked for me:

npm config set @sap:registry https://npm.sap.com

Somehow seems to point npm in the right direction.

miroll
Advisor
Advisor
0 Kudos

It is not advised to use https://npm.sap.com anymore as all publicly available SAP packages are available in the public NPM registry now.

erik_pross89
Explorer
0 Kudos

Then what is your alternative?

boris_tsirulnik
Participant
0 Kudos

This is not advised.

1. All SAP packages are available on https://www.npmjs.com/

2. In this approach you disable BAS caching mechanism for all @sap namespace.

Regards,

Boris

DanielSchneider
Explorer
0 Kudos

Hi Boris,

would you then advise to do something like this?

npm config set  @sap:registry https://www.npmjs.com/

Because right now i get "undefined" back if i try to read the parameter by:

npm config get  @sap:registry 

The proposed solution to remove "npx" in the build parameters in mta doesn't work for me, since I played around with re-installing all dependencies - with the result that I don't have the module in question in my node_modules directory locally.

So right now I'm not able to build and deploy new changes of an existing (and deployed) cap project.

erik_pross89 thanks for this, I can also confirm the behaviour with new CAP projects (no files are getting created), mentioned by you in the other reply.

Thank you
Daniel

erik_pross89
Explorer
0 Kudos

npm.sap.com redirects to https://registry.npmjs.org/

Guessing it doesn't really make a big difference then.

erik_pross89
Explorer
0 Kudos

@boris.tsirulnik ... disabling the BAS cache was the whole point, because it was not up to date and withheld us from building our applications for more than a day.

This has happened more than just this once.

Is there any way to force the BAS repo cahce to refresh? That would then be a better solution.
But I'm not going to sit around for 2 days waiting for it to happen.

boris_tsirulnik
Participant

We changed the cache interval to 30 minutes.

Let me know if you still have a problem when disabling manual registry set.

nkaur1311
Explorer

Hi Daniel,

I am still getting the same issue in BAS while doing "mbt build" . Although I tried "npm cache clean --force", it didnt work for me. As a workaround, do I need to change the registry to https://registry.npmjs.org ? Just wanted to make sure that there is no impact on deployment after doing so.

DanielSchneider
Explorer

Hi Navneet,

I can confirm this, I'm also still getting the same error.

As a workaround I did the following:

  • Create a new DEV space
  • Clone the project from git repo (or import the project in some other way)
  • Set npm registry as suggested by Erik Pross
  • Building works

Since SAP does not suggest to set the registry parameter (some caching mechanism breaks) I created a new DEV space. When everything is working again I will switch back to my original DEV space.

BR Daniel

erik_pross89
Explorer

Hi Daniel.

I think instead of using a complete other environment (although that is extra safe), I think you could also unset the variable by using the below command:

npm config delete @sap:registry

Regards,
Erik

DanielSchneider
Explorer
0 Kudos

Hi Erik,

oh didn't know that - thanks!

BR Daniel

boris_tsirulnik
Participant
0 Kudos

Hi,

We would like to reproduce the problem to troubleshoot. In our tests, the 30 minutes change solved the problem.

1. What is the git url of the git project you are cloning? (I assume it''s one of the SAP samples)

2. What is the BAS environment url? Is it trial?

Regards,

Boris

nkaur1311
Explorer
0 Kudos

Hi Boris,

To answer your questions:

1). I am using Corporate Git system and not any of the SAP samples.

2) BAS is not on trail,its https://xxxxxxxxxxxx.eu10cf.applicationstudio.cloud.sap/index.html#xxxxx

Regards,

Navneet

UniqueSeSo
Explorer
0 Kudos

Hello all

unfortunately I have the same problem in the CPD200 certificate. When calling the "mbt build -t ./".

Meanwhile is there a solution for this problem? Adjusting the registry as described does not help here...

Get the following output:

BR Sebastian

mofadili
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Team,

I am having the same issue on my SAP internal global account.

It appeared in a workspace which was working fine 2 days ago.

It looks like the following command does solve the issue:

npm config set @sap:registry https://npm.sap.com
But I have to run it each time I restart the workspace.
Regards
TiagoAlmeida
Participant
0 Kudos

We have the same issue. This has started on 04/02/2022 in eu10 BAS. Thank you

boris.tsirulnik

0 Kudos

Hello. I'm still getting this error "GET http://nginx-redirector.repo-cache.svc.cluster.local/repository/appstudio-npm-group/@sap/cds/-/cds-5.3.0.tgz". I can build the project from a trial account and from a local machine.

DanielSchneider
Explorer
0 Kudos

Hello Fedor,

I can confirm this, still getting the error as well.

BR Daniel

boris_tsirulnik
Participant
0 Kudos

Hi,

We would like to reproduce the problem to troubleshoot. In our tests, the 30 minutes change solved the problem.

1. What is the git url of the git project you are cloning? (I assume it''s one of the SAP samples)

2. What is the BAS environment url? Is it trial?

Regards,

Boris

erik_pross89
Explorer
0 Kudos

Hi Daniel and Uwe,

I also have a CAP project that (until yesterday 17:30) was building and deploying fine.
After that when I try to build again I get the exact same error you are getting.

Additionally I tried creating a completely new dev space and starting from Git. This has the same result.

After that I tried creating an empty CAP project from template in a new dev space. Now that is not even creating any files anymore (no mta.yaml, no package.json, no db, srv, app folders etc).

It seems something has broken several things in the BAS environment 😞

Regards,
Erik

Uwe_Klinger
Advisor
Advisor
0 Kudos

Hi Daniel,

You can change it in the mta.yaml file.

But its more a workaround then a solution and might not work as well.

Best regards,

Uwe

DanielSchneider
Explorer
0 Kudos

Hi Uwe,

oh sure, I oversaw that - thank you.

BR Daniel

DanielSchneider
Explorer
0 Kudos

Hi Uwe,

thank you very much for this ultra fast answer!

I'm not sure how to check that tbh. I'm using BAS and didn't change anything from the standard setup.

I also created a new dev space and cloned the project from the git repository. The result is the same.
Building was working successfully about two weeks ago.

BR Daniel

Uwe_Klinger
Advisor
Advisor
0 Kudos

Hi Daniel,

In the public NPM registry, you can find that version for @sap/cds:

https://www.npmjs.com/package/@sap/cds

You're running it in BAS?

For me it works in the trial landscape.

Please try again and open a ticket if the issue persists.

Best regards,

Uwe