Office-Addin-Scripts: Unable to start the dev server. Error: The dev server is not running on port 3000.

I’m going through the tutorial to build my first Outlook add-in. I am on Windows 10, and am using the Yeoman generator to create an Angular app:

https://docs.microsoft.com/en-us/outlook/add-ins/quick-start?context=office%2Fdev%2Fadd-ins%2Fcontext&tabs=yeomangenerator

Everything is going well until I get to this step:

Run the following command in the root directory of your project. When you run this command, the local web server will start (if it's not already running).

npm start

If I run npm start, I get this output:

> office-addin-taskpane-angular@0.0.1 start D:\Office Addin\src\OfficeAddin.Outlook
> office-addin-debugging start manifest.xml

Debugging is being started...
App type: desktop
Enabled debugging for add-in 05c2e1c9-3e1d-406e-9a91-e9ac64854143. Debug method: 0
Starting the dev server... (webpack-dev-server --mode development)
Unable to start the dev server. Error: The dev server is not running on port 3000.
Debugging started.

What am I doing wrong?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 36 (18 by maintainers)

Most upvoted comments

@DannyHinshaw I believe the manual workaround is to run “Webchain Access” and to remove all of the “Developer CA for Microsoft Office Addins” certificates listed. Then run “npx office-addin-dev-certs install”. Please let me know whether that helps solve this.

I ran into this issue on my Mac when my original certificate was close to expiration / already expired. The issue is that npx office-addin-dev-certs install adds a new certificate without removing the expiring one, npx office-addin-dev-certs verify fails because it only pulls the first (oldest) cert, which is expiring / has expired, and npx office-addin-dev-certs uninstall fails because there’s more than one certificate with the certificate name, so it can’t remove them.

After a bunch of searching, the answer is that you need to remove all of the existing certificates, including the old and new, and then try again. You can do this by running security find-certificate -c "Developer CA for Microsoft Office Add-ins" -a -Z | sudo awk '/SHA-1/{system("security delete-certificate -Z "$NF)}' from the project root directory. Once you do that, npx office-addin-dev-certs install and npx office-addin-dev-certs verify will again work.

To fix this, the install, verify, and uninstall should be updated on Mac. Install should check to see if anything with the name already exists and not install duplicate certs (because the old / expiring / expired certs won’t be purged, and will continue to stick around). verify should be fixed to either ignore expired / expiring soon certs, or to possibly warn if there are multiple matching certs with the same name. uninstall should be updated to uninstall ALL of the matching name certs, using the command above.

There should also be some investigation into the npm start and npm run dev-server commands. Before I fixed the issue locally, npm start would fail when trying to bring up the web server, but npm run dev-server would bring it up just fine, and I could connect on it at https://localhost:3000. After removing all of the certs and trying again, npm start works like it should.

Just encountered the same issue on Mac and was able to work around it with sudo for now: sudo npm start. Without the sudo, a /.office-addin-dev-certs folder wouldn’t even be created and I would get the same results as https://github.com/OfficeDev/Office-Addin-Scripts/issues/190#issuecomment-557207612.

Interestingly, everything was working without sudo before.

@akrantz I’ve tried reinstalling the certs multiple times to no avail. The dev script also tries to reinstall them every time I run it. Is it possible that something has changed in the way you check for the the certs?

I’m on a Mac by the way, so if it wasn’t for the fact that this worked just a week or two ago, I would’ve said that #168 might be related.

I was working on this issue yesterday, and it wasn’t until I removed a cert from Keychain --> Login --> Certificates that things started working for me again on Mac. The cert I removed was not actually named “Developer CA for Microsoft Office Addins”, which is the name we look for when verifying the certs during install and uninstall. Rather, the cert was issued from Microsoft and was named something like localhost 127.0.0.1. I am wondering if some sort of previous error in the cert registration process might have caused a certificate to not be fully registered and then left me in a broken state where the cert couldn’t be detected and thus not removed or removed or updated with a new expiration date.

I am investigating this some more, but at this point have lost my repro of the issue (i.e. everything is working for me now).

-Courtney

@miacrd Please see comments above. If you remove all of the certs manually from the keychain, then the command can run successfully. It appears that a Mac OS change broke functionality used to find the cert in the keychain and we’ve not found a fix yet.

@akrantz all office-addin’s are up to date (have even done a full node_modules reinstall). Please see the following outputs:

$ npx office-addin-dev-certs uninstall
The CA certificate is not installed.

$ npx office-addin-dev-certs install
The developer certificates have been generated in /Users/danny/.office-addin-dev-certs
Installing CA certificate "Developer CA for Microsoft Office Add-ins"...
You now have trusted access to https://localhost.
Certificate: /Users/danny/.office-addin-dev-certs/localhost.crt
Key: /Users/danny/.office-addin-dev-certs/localhost.key

$ npx office-addin-dev-certs verify
You need to install certificates for trusted access to https://localhost.

$ npx office-addin-dev-certs uninstall
The CA certificate is not installed.

yarn start still broken, yarn dev-server still working…