generator-office: UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token in JSON at position 3324

Prerequisites

  • I am running the latest version of Node and the tools
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Expected behavior

The generator demo should work

Current behavior

 yo office

     _-----_     ╭──────────────────────────╮
    |       |    │   Welcome to the Office  │
    |--(o)--|    │   Add-in generator, by   │
   `---------´   │ @OfficeDev! Let's create │
    ( _´U`_ )    │    a project together!   │
    /___A___\   /╰──────────────────────────╯
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

? Choose a project type: Office Add-in Task Pane project supporting single sign-on
? Choose a script type: JavaScript
? What do you want to name your add-in? SSO365
? Which Office client application would you like to support? Word

----------------------------------------------------------------------------------

      Creating SSO365 add-in for Word using JavaScript and Single-sign-on at C:\SSO365

----------------------------------------------------------------------------------

      Congratulations! Your add-in has been created! Your next steps:

      1. Go the directory where your project was created:

         cd C:\SSO365

      2. Configure your SSO taskpane add-in:

         npm run configure-sso

      3. Start the local web server and sideload the add-in:

         npm start

      4. Open the project in VS Code:

         code .

         For more information, visit http://code.visualstudio.com.

      Please visit https://docs.microsoft.com/office/dev/add-ins for more information about Office Add-ins.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. run generator as above
  2. run npm run configure-sso

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System: Windows 10 Pro 10.0.19042 Build 19042
  • Node version: 14.15.4
  • Office version: 2101 Build 13628.20380 Click-to-Run (Microsoft 365 Apps for business )
  • Tool version: yeoman latest

Failure Logs

npm run configure-sso

> office-addin-taskpane-sso-js@0.0.0 configure-sso C:\SSO365
> office-addin-sso configure manifest.xml

(node:17100) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token  in JSON at position 3324
    at JSON.parse (<anonymous>)
    at C:\SSO365\node_modules\office-addin-sso\lib\configure.js:188:40
    at Generator.next (<anonymous>)
    at C:\SSO365\node_modules\office-addin-sso\lib\configure.js:6:71
    at new Promise (<anonymous>)
    at __awaiter (C:\SSO365\node_modules\office-addin-sso\lib\configure.js:2:12)
    at C:\SSO365\node_modules\office-addin-sso\lib\configure.js:182:95
    at ChildProcess.exithandler (child_process.js:299:7)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1048:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:17100) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:17100) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 33 (1 by maintainers)

Most upvoted comments

Btw, I just published a new version of the SSO template, so if you create a new SSO project via Yo Office, it will have the “office-addin-sso” package update.

Can you please try the running the following at the root of your project to work around the loopback issue:

  • Run “npx office-addin-dev-settings appcontainer manifest.xml --loopback”
  • Say Yes when prompted with Allow localhost loopback for manifest.xml?

The starting templates are in separate github repositories. You can clone them and start with them.

However, be sure to customize the manifest and use a unique id by running: npx office-addin-manifest modify --guid --displayName <name>

Here are a few of them: Basic: https://github.com/OfficeDev/Office-Addin-TaskPane React: https://github.com/OfficeDev/Office-Addin-TaskPane-React SSO: https://github.com/OfficeDev/Office-Addin-TaskPane-SSO

The yo-office branch is what is used when you run yo office. The master branch may have more recent changes which should work. We’re constantly working to keep these templates updated.

@xstos Thanks for reporting this issue. Let me see if I can repro this issue and get back to you.

-Courtney