I can't install workbox cli

Viewed 319

I'm trying to generate a service worker using workbox CLI. I entered npm install workbox-cli --global.

This is what happened next:

(c) Microsoft Corporation. All rights reserved.

C:\Users\turbn>npm install workbox-cli --global
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
c:\npm\workbox -> c:\npm\node_modules\workbox-cli\build\bin.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\workbox-cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules\workbox-cli\node_modules\rollup\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ workbox-cli@6.2.4
updated 1 package in 32.181s

C:\Users\turbn>workbox wizard
'workbox' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\turbn>```

> As you can see I tried to start the wizard, but it looks like workbox
> hasn't installed properly. I looked up fsevents but it seems to be
> something for mac. Have I tried to install workbox for mac? I don't
> have much experience with npm so I've probably just done something
> dumb.
1 Answers

It's not clear what might the issue with your npm configuration.

I'd suggest trying to run workbox-cli without installing it globally using npx:

$ npx workbox-cli ...

as an alternative. That will hopefully work (and I think it's preferable to installing packages globally nowadays).

Related