question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npx sb init ends abruptly with EBADPLATFORM error

See original GitHub issue

Describe 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:

  1. 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:open
  • Created 2 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
WonBeomChoicommented, Apr 30, 2021

My case

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  undefined
npm ERR! notsup Actual OS:   linux
npm ERR! notsup Actual Arch: x64

change package-lock.json

"node_modules/fsevents": {
      "version": "2.3.2",
      .
      .
      .
      "os": [
        "darwin",
      ],
      "engines": {
        "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
      }
    },

to

"node_modules/fsevents": {
      "version": "2.3.2",
      .
      .
      .
      "os": [
        "darwin",
        "linux"// <<<<<<<<<<<<<<<<<<<<<<<<
      ],
      "engines": {
        "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
      }
    },

will you try add "os":["win32"] ??

2reactions
charliearayacommented, Jun 7, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

npx sb init ends abruptly with EBADPLATFORM error #14433
npx sb init ends abruptly with EBADPLATFORM error #14433 ; Describe the bug Installing storybook on a create react app based project appears...
Read more >
npm install error (code EBADPLATFORM) - node.js
Error is indicating that you are installing fsevents module in other OS rather than Mac. fsevents module ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found