How to fix npm ERR! notarget @sap/hdi-deploy@5.5.0 when you create a CAP app in BAS

Estimated read time 3 min read

When do you see this error?

1. In SAP Business Application Studio (BAS) click FileNew Project from Template.

2. Choose CAP Project and fill in the project name, runtime (Node.js), database (HANA Cloud), etc.

3. Open the terminal and run:

cds add mta # create files for Cloud Foundry / Kyma deploy
npm i # install dependencies​

4. npm i stops with this message:

npm ERR! code ETARGET
npm ERR! notarget No matching version found for /hdi-deploy@5.5.0.​

Even if you force “@SAP/hdi-deploy”: “5.4.2” in package.json, the error still appears.

 

Why does it happen?

cds add mta adds this line to devDependencies:

“@sap/cds-dk”: “>=8”

@SAP/cds-dk version 8.x asks for @SAP/hdi-deploy@5.5.0, but 5.5.0 is not yet published on npm. So npm cannot find it and throws ETARGET.

 

The 3‑line fix

1.  (Optional) clean old modules and cache:

rm -rf node_modules package-lock.json
npm cache clean –force

2. Install the latest cds-dk (today it is 9.1.3):

npm install -D @sap/cds-dk@latest

3. Install the rest:

npm install

cds-dk 9.x points to @sap/hdi-deploy 5.4.2, which exists, so the install succeeds.

 

Example package.json

{
“scripts”: {
“start”: “cds run”
},
“dependencies”: {
“@sap/cds”: “^7”,
“@sap/hana-client”: “^2”,
“@sap/xssec”: “^3”
},
“devDependencies”: {
“@sap/cds-dk”: “^9.1.3”
}
}

 

More Information

SAP Community Q&A (same issue): https://community.sap.com/t5/technology-q-a/generate-cap-project-in-bas-with-error-sap-hdi-deploy-5-4-2-not-match/qaq-p/14062673

 

Wrap‑up

Next time you hit the @sap/hdi-deploy notarget error, just remember: upgrade @sap/cds-dk and you are done.

If this post helped you, please give Kudos and leave a comment! 🙌

 

 

​ When do you see this error?1. In SAP Business Application Studio (BAS) click File → New Project from Template.2. Choose CAP Project and fill in the project name, runtime (Node.js), database (HANA Cloud), etc.3. Open the terminal and run:cds add mta # create files for Cloud Foundry / Kyma deploy
npm i # install dependencies​4. npm i stops with this message:npm ERR! code ETARGET
npm ERR! notarget No matching version found for /hdi-deploy@5.5.0.​Even if you force “@SAP/hdi-deploy”: “5.4.2” in package.json, the error still appears. Why does it happen?cds add mta adds this line to devDependencies:”@sap/cds-dk”: “>=8″@SAP/cds-dk version 8.x asks for @SAP/hdi-deploy@5.5.0, but 5.5.0 is not yet published on npm. So npm cannot find it and throws ETARGET. The 3‑line fix1.  (Optional) clean old modules and cache:rm -rf node_modules package-lock.json
npm cache clean –force2. Install the latest cds-dk (today it is 9.1.3):npm install -D @sap/cds-dk@latest3. Install the rest:npm installcds-dk 9.x points to @sap/hdi-deploy 5.4.2, which exists, so the install succeeds. Example package.json{
“scripts”: {
“start”: “cds run”
},
“dependencies”: {
“@sap/cds”: “^7”,
“@sap/hana-client”: “^2”,
“@sap/xssec”: “^3”
},
“devDependencies”: {
“@sap/cds-dk”: “^9.1.3”
}
} More InformationSAP Community Q&A (same issue): https://community.sap.com/t5/technology-q-a/generate-cap-project-in-bas-with-error-sap-hdi-deploy-5-4-2-not-match/qaq-p/14062673 Wrap‑upNext time you hit the @sap/hdi-deploy notarget error, just remember: upgrade @sap/cds-dk and you are done.If this post helped you, please give Kudos and leave a comment! 🙌    Read More Technology Blog Posts by SAP articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author