Hello BAS Team,
we've developed a CAP application in our local VS Code environment. Now we're handing over the applicaiton to the customer and they must use BAS as no local IDE installation is allowed. During the setup of the project in BAS I've noticed the following issue:
When running "npm install" in BAS the original content of package-lock.json e.g.:
"@sap/cds-odata-v2-adapter-proxy": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@sap/cds-odata-v2-adapter-proxy/-/cds-odata-v2-adapter-proxy-1.8.2.tgz",
"integrity": "sha512-fN36iWJSPIOvxnPgbKmbD4FHvXV2QxUR3cVzWLNHmVY9/C1ky1oODfsYN4fkIuxj4nuIfjYdKIsaLjnv50fRmw==",
is replaced with:
"@sap/cds-odata-v2-adapter-proxy": {
"version": "1.8.2",
"resolved": "http://nginx-redirector.repo-cache.svc.cluster.local/repository/appstudio-npm-group/@sap/cds-odata-v2-adapter-proxy/-/cds-odata-v2-adapter-proxy-1.8.2.tgz",
"integrity": "sha512-fN36iWJSPIOvxnPgbKmbD4FHvXV2QxUR3cVzWLNHmVY9/C1ky1oODfsYN4fkIuxj4nuIfjYdKIsaLjnv50fRmw==",
as you can see the version and integrity fields are exactly the same. But the resolved field does change and this results in a change that either needs to be commited to the Git repository or discarded. My temporary solution for the moment is to use:
npm ci
I understand that the registry is configured to a different location:
registry = "http://nginx-redirector.repo-cache.svc.cluster.local/repository/appstudio-npm-group/"<br>
to improve performance and avoid not necessary traffic. But maybe there is a way to keep the original resolved value?
Best Regards
Gregor
Request clarification before answering.
After I used all your hints...i still got some entries in the package-lock with the nginx-redirector which leads in the deploy process to an error 😞 any idea? Started the whole process in BAS?!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would either remove the offending entries from package-lock.json or delete package-lock.json completely and then run npm install again. Make sure if you do this in BAS that you have an .npmrc file in place as described above.
It seems that the logic in npm CLI for deciding on those registry entries is none trivial, so additional steps are needed to re-generated the package-lock.json with the correct registries entries.
Note that performing all these "cleanup" steps may result in different versions of the dependencies in the lock file.
So a find/replace may be the safest / most consistent solution.
Thank you Shachar! I followed the steps and now is working for me:
create .npmrc with URL: registry=https://registry.npmjs.com/
Delete package-lock.json
Run npm cache clean -f
Run npm i
cds push
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.