npx sb init ends abruptly with EBADPLATFORM error
See original GitHub issueDescribe the bug
Installing storybook on a create react app based project appears to crash on Windows due to usage of fsevents. *snip-snip* added in logs below for NDA reasons.
> $ npx sb init
sb init - the simplest way to add a Storybook to your project.
• Detecting project type. ✓
• Adding Storybook support to your "Create React App" based project[..................] / reify:
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: undefined
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\*snip-snip*\AppData\Local\npm-cache\_logs\2021-04-01T11_23_32_108Z-debug.log
An error occurred while installing dependencies.
The following folders are added: .storybook and stories. Nothing is changed in package.json.
npm run storybook doesn’t work either as script is missing:
npm ERR! Missing script: "storybook"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
The debug log from npm-cache ends with this:
2018 timing idealTree:node_modules/cpy/node_modules/path-type/node_modules/pify Completed in 0ms
2019 timing idealTree:buildDeps Completed in 36192ms
2020 timing idealTree:fixDepFlags Completed in 28ms
2021 timing idealTree Completed in 36944ms
2022 timing command:install Completed in 36953ms
2023 verbose stack Error: Unsupported platform
2023 verbose stack at checkPlatform (C:\ProgramData\nvm\v15.13.0\node_modules\npm\node_modules\npm-install-checks\index.js:35:25)
2023 verbose stack at Arborist.[checkPlatform] (C:\ProgramData\nvm\v15.13.0\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:235:5)
2023 verbose stack at C:\ProgramData\nvm\v15.13.0\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:228:33
2023 verbose stack at async Arborist.buildIdealTree (C:\ProgramData\nvm\v15.13.0\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:212:7)
2023 verbose stack at async Promise.all (index 1)
2023 verbose stack at async Arborist.reify (C:\ProgramData\nvm\v15.13.0\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:131:5)
2023 verbose stack at async Install.install (C:\ProgramData\nvm\v15.13.0\node_modules\npm\lib\install.js:137:5)
2024 verbose pkgid fsevents@2.3.1
2025 verbose cwd C:\Projects\*snip-snip*
2026 verbose Windows_NT 10.0.19042
2027 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--legacy-peer-deps" "-D" "@storybook/react@^6.2.1" "@storybook/addon-links@^6.2.1" "@storybook/addon-essentials@^6.2.1" "@storybook/addon-actions@^6.2.1" "@storybook/node-logger@^6.2.1" "@storybook/preset-create-react-app@^3.1.7"
2028 verbose node v15.13.0
2029 verbose npm v7.7.6
2030 error code EBADPLATFORM
2031 error notsup Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin"} (current: {"os":"win32","arch":"x64"})
2032 error notsup Valid OS: darwin
2032 error notsup Valid Arch: undefined
2032 error notsup Actual OS: win32
2032 error notsup Actual Arch: x64
2033 verbose exit 1
To Reproduce Steps to reproduce the behavior:
npx sb init
Expected behavior
No errors, and with package.json updated with required packages and a storybook task.
Screenshots Not applicable
Code snippets Not applicable
System
Results of npx sb@next info:
Environment Info:
System: OS: Windows 10 10.0.19042 CPU: (12) x64 Intel® Core™ i7-10850H CPU @ 2.70GHz Binaries: Node: 15.13.0 - C:\Program Files\nodejs\node.EXE npm: 7.7.6 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.423.0), Chromium (89.0.774.63)
Additional context
- Create react app installed
react-scripts@4.0.1. - Using typescript template for create-react-app
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (2 by maintainers)

Top Related StackOverflow Question
My case
change package-lock.json
to
will you try add
"os":["win32"]??Hade the same issue, installed latest Node (v16.3.0) with npm v7.15.1 and it seems to work fine now. Running react v17.0.2.