OfficeDev / generator-office

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

Error: self signed certificate in certificate chain when creating project #720

Closed mahaoyu closed 1 year ago

mahaoyu commented 2 years ago

Hi All,

I run into the following error when I'm trying to scaffold any project using yo office:

? Choose a project type: Office Add-in Task Pane project ? Choose a script type: JavaScript ? What do you want to name your add-in? test88 ? Which Office client application would you like to support? Excel


  Creating test88 add-in for Excel using JavaScript and Taskpane at /Users/mhansal/test88

Unable to download project zip file for "https://github.com/OfficeDev/Office-Addin-TaskPane-JS/archive/yo-office.zip". Error: self signed certificate in certificate chain

I am on macOS Monterey 12.4; npm 8.11; node v16.15.1 and generator-office@1.8.8; yo@4.3.0.

After spending hour searching and trying solutions, I understand this might be related to the corporate firewall, that I'm under, but I can't seem to work out any solution. Few things I tried include:

Wondering if this is an actual issue and thus reaching out here. Could anyone help me?

Thanks in advance, Mat

slack2450 commented 2 years ago

Hey Matt,

I came across this issue as I was also sitting behind a corporate firewall. The way I solved this was by setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' on powershell that's $Env:NODE_TLS_REJECT_UNAUTHORIZED = '0'

It does what it says on the tin stops checking HTTPS certificates authenticity... Obviously not recommended to leave enabled but if you visit the website manually and find the certificate being served is your corporate one you can go ahead and temporarily run this change.

Hope this helps Joss

mahaoyu commented 1 year ago

Hi Joss, A big belated thank you for your response. This works like a charm from powershell. Happy new year to you and all the best into 2023. Mat