Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npx sb init ends abruptly with EBADPLATFORM error #14433

Open
spoike opened this issue Apr 1, 2021 · 16 comments
Open

npx sb init ends abruptly with EBADPLATFORM error #14433

spoike opened this issue Apr 1, 2021 · 16 comments

Comments

@spoike
Copy link

spoike commented Apr 1, 2021

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(R) Core(TM) 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
@spoike
Copy link
Author

spoike commented Apr 1, 2021

I tried to install one of the deps (@storybook/react@6.2.1) from the last command stated in the debug log and it also fails with the same error.

> npm i --legacy-peer-deps -D @storybook/react@6.2.1
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

@shilman
Copy link
Member

shilman commented Apr 1, 2021

@tooppaaa you use windows right? ever seen this?

@tooppaaa
Copy link
Contributor

tooppaaa commented Apr 1, 2021

All good on my side with a fresh create-react-app using the same command. However I'm running node 12. Any chance you can downgrade and let us know @spoike ?

@spoike
Copy link
Author

spoike commented Apr 6, 2021

I've switched over to 12.22.0 with nvm for windows. And npx sb init works with a caveat on different version on package-log.json:

 • Adding Storybook support to your "Create React App" based project[..................] / rollbackFailedOptional: verb npm-sessionnpm 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!

However fsevents is correctly skipped (since it's only for mac):

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.1 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\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@1.2.13 (node_modules\watchpack-chokidar2\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"})

Running npm run storybook works on 12.22.0 (after fixing all the prettier errors from the generated files 😄)

You can do the following on 15.13.0 after successful run of npx sb init with 12.22.0:

  • npm run storybook works
  • npm ci works
  • Removing node_modules and npm i works (lol what ❓)

@spoike
Copy link
Author

spoike commented Apr 6, 2021

Tried to issue the npx sb init command on the following versions:

  • 15.13.0 - doesn't work, EBADPLATFORM error
  • 14.16.0 - works
  • 12.22.0 - works

edit: I accidentally ran 15 instead of 14, but can confirm it works on 14.

@WikiRik
Copy link

WikiRik commented Apr 8, 2021

I get the same issue, but for a Vue application.


 • Detecting project type. ✓
 • Adding Storybook support to your "Single File Components Vue" app. ✓
 • Preparing to install dependencies. ✓



up to date, audited 2753 packages in 4s

5 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
. ✓

To run your Storybook, type:

   npm run storybook 

For more information visit: https://storybook.js.org

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\riksm\AppData\Local\npm-cache\_logs\2021-04-08T22_09_05_026Z-debug.log
An error occurred while installing dependencies.```

I'm using Node 14.16.1, tested both npm 6.14.12 and npm 7.9.0 on Windows 10 at the moment. The project I'm trying to add Storybook to is https://github.com/AEGEE/frontend

Edit: same project is running fine on Ubuntu

@SonuTheDev
Copy link

Tried to issue the npx sb init command on the following versions:

  • 15.13.0 - doesn't work, EBADPLATFORM error
  • 14.16.0 - works
  • 12.22.0 - works

edit: I accidentally ran 15 instead of 14, but can confirm it works on 14.

Not working in v14.16.0

@spoike
Copy link
Author

spoike commented Apr 29, 2021

I didn't check what npm version I used on 14.16.0, but it could be related to npm rather than node instead (since it fails due to the --legacy-peer-deps flag)?

@spoike
Copy link
Author

spoike commented Apr 29, 2021

This might be related to this issue on npm/cli project, where EBADPLATFORM is treated as an error rather than a warning:

npm/cli#2921

@WonBeomChoi
Copy link

WonBeomChoi commented 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"] ??

@charliearaya
Copy link

charliearaya commented 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.

@ken-bekov
Copy link

ken-bekov commented Oct 6, 2021

I still have the same issue running npx sb init on Node 16.1.0 with npm 7.24.2 for React 17.0.2 project (created using CRA)

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@2.3.2: 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

@shilman shilman added this to the 7.2 sb dev errors milestone Jun 8, 2023
@SunnySun1027
Copy link

Same issue on node v18.17.0 and npm 9.6.7 when run this command on React 18 project

• Installing dependencies
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for @next/swc-darwin-arm64@14.1.0: wanted {"os":"darwin","cpu":"arm64"} (current: {"os":"darwin","cpu":"x64"})
npm ERR! notsup Valid os: darwin
npm ERR! notsup Actual os: darwin
npm ERR! notsup Valid cpu: arm64
npm ERR! notsup Actual cpu: x64

@valentinpalkovic
Copy link
Contributor

valentinpalkovic commented Jan 24, 2024

@SunnySun1027 Do you have @next/swc-darwin-arm64 as a dependency listed in your package.json? I am curious why it tries to install it, although you are on a platform, which obviously doesn't support that package.

Could you also go through these possible fixes?

@SunnySun1027
Copy link

3q, That's right! The project used the @next/swc-darwin-arm64 package and I installed by --force command then saved into my package.json. npx sb init will kindly to add the "--force " parameter to install the project dependencies.

@valentinpalkovic
Copy link
Contributor

May I ask you why @next/swc-darwin-arm64 is installed as a separate package? As far as I know, it is not necessary to install it separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants