Forum Discussion

Mudassir_Nayyer's avatar
Mudassir_Nayyer
Copper Contributor
Jan 13, 2023

Unable to use Microsoft Teams JavaScript client library in Angular Project

Hi,

 

We have been following the documentation to develop MS Teams meeting extension app using Angular as our Client side framework. We have successfully develop few screens of the app with SSO implementation and its working.

 

Now, we are not able to add teams library to any of our new components though we have used same library in other components and its working. We are using this piece of code to add library (import * as microsoftTeams from "@microsoft/teams-js") and when we use "microsoftTeams" object in any function it breaks,  (https://learn.microsoft.com/en-us/javascript/api/overview/msteams-client?view=msteams-client-js-latest). Due to the reason as soon as we add this library our server fails to start with following error 
"npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! events-light@1.0.0 serve:ssr: `node --prof dist/server/main.js`npm ERR! Exit status 1npm ERR!npm ERR! Failed at the events-light@1.0.0 serve:ssr script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: the log file"

  • Mudassir_Nayyer - Could you please try to delete the node_modules folder and package-lock.json and check it once again? And please confirm which version you are importing @microsoft/teams-js 2.6.1 or 2.7.1?

     

     

    • Mudassir_Nayyer's avatar
      Mudassir_Nayyer
      Copper Contributor

      Hi Prasad,

       

      We are using Pernille-Eskebo/teams-js 2.6.1. We have already tried deleting the node_modules and package-lock.json file but no luck. should we update the package?

    • Mudassir_Nayyer's avatar
      Mudassir_Nayyer
      Copper Contributor
      Prasad_Das-MSFT

      I have tried updating the package to latest version as well ("@microsoft/teams-js": "^2.7.1"). But, as soon as I run build my project "npm run build:dev:ssr" and then run it using "npm run serve:ssr" it fails to start my application.
      • ChetanSharma-msft's avatar
        ChetanSharma-msft
        Icon for Microsoft rankMicrosoft

        Mudassir_Nayyer - Could you please share your complete log?
        As you have mentioned that you have used same library in other components and it's working fine. Could you please check the differences in these components and check the packages dependencies.


Resources