OfficeDev / generator-office

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

Error during setup: Unsupported platform for fsevents@2.3.2 #707

Closed AlexJerabek closed 2 years ago

AlexJerabek commented 2 years ago

Current behavior

Running yo office with the following configuration generates errors and does not successfully create an add-in.

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

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Install yo office
  2. Run yo office
  3. Use the following options: Choose a project type: Office Add-in Task Pane project Choose a script type: JavaScript What do you want to name your add-in? My Office Add-in Which Office client application would you like to support? Excel

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Failure Logs

aljerabe@Tiresias MINGW64 /c/GitHub $ 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? My Office Add-in ? Which Office client application would you like to support? Excel


  Creating My Office Add-in add-in for Excel using JavaScript and Taskpane at C:\GitHub\My Office Add-in

I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.

No change to package.json was detected. No package manager install will be executed. npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it! npm ERR! code EBADPLATFORM npm ERR! notsup Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm ERR! notsup Valid OS: darwin npm ERR! notsup Valid Arch: any npm ERR! notsup Actual OS: win32 npm ERR! notsup Actual Arch: x64

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\aljerabe\AppData\Roaming\npm-cache_logs\2022-05-09T20_51_23_837Z-debug.log

  Congratulations! Your add-in has been created! Your next steps:

  1. Go the directory where your project was created:

     cd "C:\GitHub\My Office Add-in"

  2. Start the local web server and sideload the add-in:

     npm start

  3. Open the project in VS Code:

     code .

     For more information, visit http://code.visualstudio.com.

  Please visit https://docs.microsoft.com/office/dev/add-ins for more information about Office Add-ins.

millerds commented 2 years ago

What happens when you run 'npm install" in the project that is generated? What version of npm do you have installed?

AlexJerabek commented 2 years ago

I'm on npm 6.14.14. I get the same error running npm install in the created project. I've attached the log file.

aljerabe@Tiresias MINGW64 /c/GitHub/Test
$ npm install
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: x64

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\aljerabe\AppData\Roaming\npm-cache\_logs\2022-05-11T19_05_24_037Z-debug.log

2022-05-11T19_05_24_037Z-debug.log

millerds commented 2 years ago

Looks like this is an incompatibility between the package-lock.json file generated by different versions of npm. v8 uses a new package-lock file format version. v6 will attempt to use it and install anyway, but apparently optional dependencies (fsevent is only supposed to be install on mac or linux) are not interpreted the same. If you delete the package-lock.json it will work and if you update to a newer version of npm (v8 is the current version along with v16 of node) it will also work.

akrantz commented 2 years ago

This isn't a problem. fsevents is supported on mac but not win32 and is an optional dependency. If you move to NPM v16, the optional dependencies aren't installed and you won't encounter a warning. For NPM v14, the warning can be ignored.

akrantz commented 2 years ago

Sorry I referenced Node versions, but the NPM versions, e.g 6.x for Node 14, and Node 16 installs 7.x but the latest is actually 8.x. Point being is that the latest NPM no longer shows this warning.

AlexJerabek commented 2 years ago

Thanks @millerds! That fixed it.