OfficeDev / generator-office

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

Excel functions add-in project seems to be broken #668

Closed GregReddick closed 3 years ago

GregReddick commented 3 years ago

When I follow the install process shown at https://docs.microsoft.com/en-us/office/dev/add-ins/quickstarts/excel-custom-functions-quickstart?tabs=excel-windows exactly, the project fails to build. When I run the "npm run build" command, I get the following error message:

excel-custom-functions-js@2.0.0 build D:\temp\starcount webpack --mode production

(node:9728) UnhandledPromiseRejectionWarning: TypeError: The 'compilation' argument must be an instance of Compilation at Function.getCompilationHooks (D:\temp\starcount\node_modules\webpack\lib\NormalModule.js:203:10) at D:\temp\starcount\node_modules\custom-functions-metadata-plugin\lib\customfunctionsplugin.js:54:36 at Hook.eval [as call] (eval at create (D:\Temp\starcount\node_modules\tapable\lib\HookCodeFactory.js:19:10), :100:1) at Hook.CALL_DELEGATE [as _call] (D:\Temp\starcount\node_modules\tapable\lib\Hook.js:14:14) at Compiler.newCompilation (D:\Temp\starcount\node_modules\webpack\lib\Compiler.js:1044:26) at D:\Temp\starcount\node_modules\webpack\lib\Compiler.js:1088:29 at eval (eval at create (D:\Temp\starcount\node_modules\tapable\lib\HookCodeFactory.js:33:10), :13:1) (Use node --trace-warnings ... to show where the warning was created) (node:9728) 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:9728) [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.

What am I doing wrong? When I build the Excel Task Pane project for Excel, everything works okay, but the Excel Custom Functions Add-in project is broken. I have tried everything I can think of.

millerds commented 3 years ago

If I follow the steps it works fine.

Occasionally I have seen cases where the 'npm install' command that runs at the end of 'yo office' fails. The error message should tell you to run it manually if that happens. In any case, try running 'npm install' in the directory and then run 'npm run build' again.

GregReddick commented 3 years ago

I tried that (both before and today), with no better results. Thinking that there might be something wrong with my environment, I went to another computer and tried the same thing, with exactly the same error message.

GregReddick commented 3 years ago

AHA...I have isolated it. If I use a DOS prompt to do the "npm run build" everything works okay. If I use Windows Powershell, it fails with the above error. This is consistent across three computers.

millerds commented 3 years ago

Glad you figured it out. We'll take a look to see if this is something we should fix. Feel free to express how important you think it is to be completely PowerShell compatible.

GregReddick commented 3 years ago

Personally, I don't care whether there is Powershell support. But damn, I could have used some documentation (or a better error message) that it wouldn't work there rather than beating my head against a wall for many hours. There wasn't anything that was pointing at the shell being the problem and not the packages.