OfficeDev / generator-office

Yeoman generator for building Microsoft Office related projects.
https://www.npmjs.com/package/generator-office
MIT License
825 stars 208 forks source link

Unable to start the dev server if a parent directory has a white space in its name #690

Closed dimitri-bourreau closed 2 years ago

dimitri-bourreau commented 2 years ago

Expected behavior

npm start should execute the server correctly, no matter if in the path of the current directory is a white space.

Current behavior

If a white space is in the path of the current directory, npm start will log this:

Starting the dev server... (webpack serve --mode development)
Unable to start the dev server. Error: The dev server is not running on port 3000.
Sideloading the Office Add-in...
Error: Unable to start debugging.
Error: Unable to sideload the Office Add-in.
Error: Sideload to the Outlook app is not supported.

Steps to Reproduce

Confirm expected success when no parent directory has a white space in its name

pwd here is : /Users/dimitri/Desktop.

~/Desktop » 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
? Choose a script type: JavaScript
? What do you want to name your add-in? add-in
? Which Office client application would you like to support? Outlook

~/Desktop » cd add-in
~/Desktop/add-in » npm start 

> office-addin-taskpane-js@0.0.1 start
> office-addin-debugging start manifest.xml

Debugging is being started...
App type: desktop
Starting the dev server... (webpack serve --mode development)
The dev server is running on port 3000. Process id: 7702
Sideloading the Office Add-in...
Error: Unable to start debugging.
Error: Unable to sideload the Office Add-in.
Error: Sideload to the Outlook app is not supported.

(last errors are another subject, though, the server is listening as lsof -i -P | grep 3000 confirms and the add-in working just fine)

Repeat the previous steps, while a parent directory has a white space in its name

pwd here is : /Users/dimitri/Desktop/this is-a-test.

~/Desktop/this is-a-test » 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
? Choose a script type: JavaScript
? What do you want to name your add-in? add-in
? Which Office client application would you like to support? Outlook

~/Desktop/this is-a-test » cd add-in
~/Desktop/this is-a-test/add-in » npm start 

> office-addin-taskpane-js@0.0.1 start
> office-addin-debugging start manifest.xml

Debugging is being started...
App type: desktop
The developer certificates have been generated in /Users/dimitri/.office-addin-dev-certs
Installing CA certificate "Developer CA for Microsoft Office Add-ins"...
Password:
You now have trusted access to https://localhost.
Certificate: /Users/dimitri/.office-addin-dev-certs/localhost.crt
Key: /Users/dimitri/.office-addin-dev-certs/localhost.key
Starting the dev server... (webpack serve --mode development)
Unable to start the dev server. Error: The dev server is not running on port 3000.
Sideloading the Office Add-in...
Error: Unable to start debugging.
Error: Unable to sideload the Office Add-in.
Error: Sideload to the Outlook app is not supported.

Weirdly, when the parent directories have no white space there is nothing about the certificate.

Context

I have the habit to store my code bases in an external SSD, which is named after my name Dimitri Bourreau.

The issue is not new, the last comment of #470 from 2019/08 refers to it. I had a very similar issue with another program: I found somewhere files paths were managed as URL, thus white spaces would not be kept later on the code.

millerds commented 2 years ago

Hmm . . . this appears to be an issue with mac specifically as it doesn't happen on windows. We'll have to take a look and fix it.

millerds commented 2 years ago

Looks like it's the cert verification that is creating the problem . . . the path to the verify script file is the project path the space isn't escaped or quoted.

dimitri-bourreau commented 2 years ago

Is there anything planned on this? (I'm reviewing all my GitHub issues, this one seems quick to be fixed)

millerds commented 2 years ago

This fix has been added to the office-addin-script repo where the actual problem is. I don't believe it has been pushed out in a new version yet, but it should be in the next month.