Skip to Content
Technical Articles
Author's profile photo Sven Kohlhaas

SAP NPM Registry launched: Making the lives of Node.js developers easier

Update: npm.sap.com will be retired by February 28th, 2022. Please change to npmjs.org. Please refer to SAP Note 3109201 for further details.

Update: As of June 10th, 2020 all public SAP Node.js modules from the SAP NPM registry will become part of the official NPM registry, as well as future public SAP Node.js modules will be published there. The SAP NPM registry will continue to exist for the time being with the so far published content. The recommendation to developers is to switch now to using the official NPM registry also for all public SAP Node.js modules.

Hi everyone,

As you might have heard today during SAPPHIRE NOW in Orlando or already experienced in our updated SAP Cloud Platform Cockpit, we just announced the general availability of our Cloud Foundry-based environment on SAP Cloud Platform .

To make life easier if you want to develop a Node.js application for our Cloud Foundry-based environment on SAP Cloud Platform, we are launching the SAP NPM Registry https://npm.sap.com where we publish @sap scoped modules. All other modules are still downloaded from the default registry at https://registry.npmjs.org .

If you are not yet that into Node.js and are wondering now what I’m talking about: NPM stands for Node Package Manager and it’s the package manager for JavaScript and especially Node.js as a sort of industry standard. In many ways, you can compare it to Apache Maven in the Java world. Regarding NPM in general, you can find more information here https://docs.npmjs.com/getting-started/what-is-npm .

To enable that your NPM client installation uses the SAP NPM Registry for @sap scoped modules use the command “npm config set @sap:registry https://npm.sap.com” without the “” in your command line after the installation of NPM. This creates/edits the .npmrc file in your user folder and adds the line “@sap:registry=https://npm.sap.com” without the “”. That’s the configuration for your NPM client installation so that it knows where to get the @sap scoped modules from. Alternatively, you can also create/edit the .npmrc file and add the line manually.

If you want to see what modules are currently available, perform a search after the keyword “sap”:

All the best,

Sven

Assigned Tags

      31 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Sven,

      Could you please also share some information how these node modules would be used in an application running on sap cloud platform? Is there any documentation and example applications available which show the benefit of these modules?

      Thanks.

      Author's profile photo Sven Kohlhaas
      Sven Kohlhaas
      Blog Post Author

      Hi Sven,

      please have a look here https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/b8ee7894fe0b4df5b78f61dd1ac178ee.html . Those Node.js modules will be needed if you want build an Node.js application for SAP Cloud Platform, e.g. to use the logging, persistence, security, etc. features of the platform in your application. Previously, you had to download those modules via SAP Service Marketplace, having our own SAP NPM Registry makes consuming them much easier.

      All the best,

      Sven

      Author's profile photo Former Member
      Former Member

      Hi Sven,

      Sorry, but I'm not able to find any documentation or examples for the node.js modules in the documentation you are referencing.

      I have an SAP Cloud Platform account and I know how to develop in your Cloud Foundry environment. But where can I find concrete examples (as you mentioned logging, persistence, security) which makes use of these published node.js modules?

      Thank you very much for more precise documentation/examples regarding the mentioned node.js modules.

      Regards, Sven

      Author's profile photo Sven Kohlhaas
      Sven Kohlhaas
      Blog Post Author

      Hi Sven,

      for logging please have a look at the following links:

      For several of the other topics we are working on further more detailed documentation and sample applications.

      All the best,

      Sven

      Author's profile photo Michael Engler
      Michael Engler

      How can I or rather any customer get the permission to download files from this SAP npm?

      Author's profile photo Sven Kohlhaas
      Sven Kohlhaas
      Blog Post Author

      Hi Michael,

      the SAP NPM Registry is public and free for use, you or any customer can just connect with the NPM client to it and download the modules from there during the build of your projects.

      All the best,

      Sven

      Author's profile photo Stefan Hipfel
      Stefan Hipfel

      Hi Sven,

       

      is it also possible to contribute new modules developed in the teams @sap?

       

      Thanks

      Author's profile photo Sven Kohlhaas
      Sven Kohlhaas
      Blog Post Author

      Hi Stefan,

      yes, it is also possible and definitely encouraged to contribute new modules developed in the teams @SAP there as well, I will send you a PM with more details.

      All the best,

      Sven

      Author's profile photo Former Member
      Former Member

      Hi, Sven

      Could you please send me a PM about how to contribute my developed utility NodeJS module into the SAP NPM Registry?

      Author's profile photo Vincent Huang
      Vincent Huang

      Hi Sven,

       

      Could you please send me PM info, I would like to contribute to SAP npm modules.

       

      Thanks,

      Vincent

      Author's profile photo Former Member
      Former Member

      Hi Sven,

      I want to run the sample: https://github.wdf.sap.corp/cdx/odata-v4-samples/tree/master/readEntityCollection

      This makes use of @sap/odata-v4": "^0.0.1-alpha.4

      I cannot find this package in https://npm.sap.com
      Do you know where I can take it from?

      Thank you!

      Andreea

      Author's profile photo Sven Kohlhaas
      Sven Kohlhaas
      Blog Post Author

      Will send you a PM

      Author's profile photo Former Member
      Former Member

      HI Sven Kohlhaas – is there any node package for neo apps that could help us test those applications locally or for consuming the neo-app.json file for destinations. We currently face issues due to the incompatibility of xs-app.json and neo-app.json routing and it would be nice to have the transparency of being able to actually troubleshoot these like other node applications

      By the way, great news about the npm generally! it already helped sort a few things out.

      Author's profile photo Sven Kohlhaas
      Sven Kohlhaas
      Blog Post Author

      Hi Lindsay,

       

      such a node package we don't have currently but a good suggestion, I will take it into our feedback list.

       

      All the best,

      Sven

      Author's profile photo Matthias Günter
      Matthias Günter

      Hi,

      isn't it currently supported to install a package from the own SCP git repository? I want to create a  module within the SCP without publishing it to Github / NPM Registry. When adding a SCP [...].git URL as dependency it is not possible to resolve the dependency.

      It is also not possible to install a Github Gist (https://gist.github.com/). A github gist can be installed with "gist:[<githubname>/]<gistID>[#<commit-ish>|#semver:<semver>]" (reference https://docs.npmjs.com/cli/install) but the following error occurs: https://codepaste.net/hsj68j

      Best regards,
      Matthew 🙂

      Author's profile photo Georgi Farashev
      Georgi Farashev

      Hi,

      The link https://codepaste.net/hsj68j doesn't work. What is the error you are receiving?

      Best regards,

      Georgi

      Author's profile photo Matthias Günter
      Matthias Günter

      Sorry for my late reply... When I locally use

      npm install gist:7d867cda127e64d38f28 --save

      it installs the GitHub Gist (https://gist.github.com/HugoGiraudel/7d867cda127e64d38f28) and I can use it in my project. Afterwards the package.json contains the following dependency:

      {
        "dependencies": {
          "blingdotjs": "gist:7d867cda127e64d38f28"
        }
      }

      But when I try to build the same project (with the above dependency) in the SAP Cloud Platform Full-Stack WebIDE it fails with the following error:

      14:32:20 (DIBuild) Build of /someapplication in progress
      14:32:20 (DIBuild) [INFO] Retrieving source code
      [INFO] Preparing node environment
      14:32:23 (DIBuild) [INFO] Installing node dependencies
      14:32:26 (DIBuild) npm ERR! git clone --template=/usr/wrk/tmp.DNw8Ne0DDL/npm_cache/_git-remotes/_templates --mirror git@gist.github.com:/7d867cda127e64d38f28.git /usr/wrk/tmp.DNw8Ne0DDL/npm_cache/_git-remotes/git-gist-github-com-7d867cda127e64d38f28-git-897203f6: undefined
      npm ERR! Linux 4.11.7
      npm ERR! argv "/opt/node-v6.9.1-linux-x64/bin/node" "/opt/node-v6.9.1-linux-x64/bin/npm" "install"
      npm ERR! node v6.9.1
      npm ERR! npm  v3.10.8
      npm ERR! code ENOGIT
      npm ERR! not found: git
      npm ERR! 
      npm ERR! Failed using git.
      npm ERR! This is most likely not a problem with npm itself.
      npm ERR! Please check if you have git installed and in your PATH.
      npm ERR! Please include the following file with any support request:
      npm ERR!     /usr/wrk/tmp.DNw8Ne0DDL/proj/npm-debug.log

      Regards,
      Matthew 🙂

      Author's profile photo Yaniv Barzilai
      Yaniv Barzilai

      Hi Matthew,

      While DI is built, npm client tries to run "git clone" command.

      However, currently Web IDE Full-Stack does not support git environment and this is why it fails.

      We are considering supporting git in Web IDE Full-Stack.

      Thanks and Best Regards,

      Yaniv

      Author's profile photo Bert Deterd
      Bert Deterd

      Cannot search the sap registry

      Author's profile photo Georgi Farashev
      Georgi Farashev

      Hi,

      Do you still get this error?

      I think this was fixed.

      Best regards,

      Georgi

      Author's profile photo Bert Deterd
      Bert Deterd

      Still not possible

      Author's profile photo Georgi Farashev
      Georgi Farashev

      What is your node and npm versions?

      Author's profile photo Bert Deterd
      Bert Deterd

      Cannot deploy @sap packages to Cloud Foundry SAP Cloud Platform

      Author's profile photo Georgi Farashev
      Georgi Farashev

      Hi,

      Can you try and add:

      "NPM_CONFIG_@SAP:REGISTRY": https://npm.sap.com

      in your application environment?

      This should tell npm to search @sap packages in https://npm.sap.com.

      Best regards,

      Georgi

       

      Author's profile photo Christian Schuff
      Christian Schuff

      This is really cool stuff! Thanks a lot!

      Adding a UI with search, viewable README-files etc. to the registry would be even a lot cooler 🙂

      BR Chris

      Author's profile photo Sven Kohlhaas
      Sven Kohlhaas
      Blog Post Author

      Hi Christian,

      we are working on something in that direction, keep posted!

      All the best,

      Sven

      Author's profile photo Stefanus Zhang
      Stefanus Zhang

      Hi there Sven,

      Is there by any chance a documentation that shows the different versions of a particular package?

      The only one that I seems to be able to see is the list of packages available without its version.

      https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.03/en-US/54513272339246049bf438a03a8095e4.html#loio54513272339246049bf438a03a8095e4__section_rmz_bqq_25

      For example for a normal npm package, https://www.npmjs.com/package/http-server

      We can see the available versions.

      At the moment, it seems there is no list and we do not know which version there is until build time and sometime minor update could break things.

      Thanks!

      Author's profile photo Sven Kohlhaas
      Sven Kohlhaas
      Blog Post Author

      Hi Stefanus,

      you are correct, something like this is not available. Thanks for your feedback, we will take it into our planning.

      All the best,

      Sven

      Author's profile photo Christian Schuff
      Christian Schuff

      A searchable UI displaying versions, the README.md files etc. would be of great help!

      Thanks and BR

      Chris

      Author's profile photo Ekansh Saxena
      Ekansh Saxena

      Hello,

      When I try to install a sap npm module, it gives the following error:

      Here I am doing 'npm install' but I encountered the error on 'npm audit fix' so tried to do check with npm install and faced same issue.

      BR, Ekansh

      Author's profile photo Holger Schäfer
      Holger Schäfer

      Hi guys,

      Gregor Wolf created a collection of sap npm packages docu and i added the mkdocs site around it.

      See: https://gregorwolf.github.io/SAP-NPM-API-collection/

      A lot of the packages have a change log included like

      https://gregorwolf.github.io/SAP-NPM-API-collection/apis/approuter/CHANGELOG/

      and you can also search the whole api set.

      This maybe helps you a little bit, till sap comes around with a tool adressing this (like api hub)

      This is quite handy for me.

      Regards Holger