OfficeDev / generator-office

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

Could not create project with Yeoman #765

Closed chuyaowang closed 1 year ago

chuyaowang commented 1 year ago

Hi, I tried to follow the tutorial but could not create a project with Yeoman. I am using a M1 macbook with macOS Monterey 12.6.3 Error as follows:

AssertionError [ERR_ASSERTION]: protocol mismatch
    at Object.request (/usr/local/lib/node_modules/generator-office/node_modules/follow-redirects/index.js:521:14)
    at dispatchHttpRequest (/usr/local/lib/node_modules/generator-office/node_modules/axios/dist/node/axios.cjs:2810:21)
    at new Promise (<anonymous>)
    at http (/usr/local/lib/node_modules/generator-office/node_modules/axios/dist/node/axios.cjs:2520:10)
    at Axios.dispatchRequest (/usr/local/lib/node_modules/generator-office/node_modules/axios/dist/node/axios.cjs:3481:10)
    at Axios.request (/usr/local/lib/node_modules/generator-office/node_modules/axios/dist/node/axios.cjs:3831:33)
    at wrap (/usr/local/lib/node_modules/generator-office/node_modules/axios/dist/node/axios.cjs:29:15)
    at Object.<anonymous> (/usr/local/lib/node_modules/generator-office/generators/app/helpers/helperMethods.js:51:40)
    at Generator.next (<anonymous>)
    at /usr/local/lib/node_modules/generator-office/generators/app/helpers/helperMethods.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/generator-office/generators/app/helpers/helperMethods.js:4:12)
    at Object.downloadProjectTemplateZipFile (/usr/local/lib/node_modules/generator-office/generators/app/helpers/helperMethods.js:49:16)
    at module.exports.<anonymous> (/usr/local/lib/node_modules/generator-office/generators/app/index.js:317:61)
    at Generator.next (<anonymous>)
    at /usr/local/lib/node_modules/generator-office/generators/app/index.js:8:71

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

ElizabethSamuel-MSFT commented 1 year ago

@chuyaowang Thanks for letting us know about this.

@millerds Can you take a look?

Thanks.

millerds commented 1 year ago

The process of generated a project includes downloading code from the template github repository. The call stack suggest that something is going wrong accessing github. Is there something special about the network you are connected to? Are you able to browse github repositories?

chuyaowang commented 1 year ago

Thanks for the reply. I will take a look at my network settings and try again.

chuyaowang commented 1 year ago

I can ping github.com with no problem. I also ran yo office with sudo. This error message showed:

Unable to download project zip file for "https://github.com/OfficeDev/Office-Addin-TaskPane-JS/archive/yo-office.zip".
Error: socket hang up

I can download this archive from browser. Is there anything else Yeoman does besides extracting it and placing it in the project directory?

millerds commented 1 year ago

The zip file is downloaded, extracted, and the copied over to the target locations. Then it runs the convertToSingleHost.js script inside the project with an argument of which host you are looking for. Finally 'npm install' is run.

kavyasukumar commented 1 year ago

Running into the same issue of not being able to download the zip file on Windows as well

Unable to download project zip file for "https://github.com/OfficeDev/Office-Addin-TaskPane-JS/archive/yo-office.zip".
Error: unable to get local issuer certificate
chuyaowang commented 1 year ago

The problem disappeared after I switched to a different internet proxy. It is indeed a network issue. However, npm install in the installation script produced the following error:

No change to package.json was detected. No package manager install will be executed.
npm WARN config cache-min This option has been deprecated in favor of `--prefer-offline`.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: office-addin-taskpane-js@0.0.1
npm ERR! Found: webpack@undefined
npm ERR! node_modules/webpack
npm ERR!   dev webpack@"^5.76.3" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@">=2" from babel-loader@8.3.0
npm ERR! node_modules/babel-loader
npm ERR!   dev babel-loader@"^8.2.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /Users/wangchuyao/.npm/_logs/2023-05-25T03_06_59_984Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /Users/wangchuyao/.npm/_logs/2023-05-25T03_06_59_984Z-debug-0.log

I fixed the issue by entering and running npm install in the terminal.

millerds commented 1 year ago

The npm error seems to come along every now and again when it is run by the webpack environment. Running it in a project seems to fix it for the generator as well.