storybook: `sb migrate` doesn't work with npx

$ npx -p @storybook/cli@5.2.0-beta.17 sb migrate storiesof-to-csf --glob "components/**/*.examples.js"
[BABEL] Note: The code generator has deoptimised the styling of /Users/jetbrains/.npm/_npx/50842/lib/node_modules/@storybook/cli/node_modules/lodash/lodash.js as it exceeds the max of 500KB.
=> Applying storiesof-to-csf: 117 files
yarn run v1.17.3
error Command "jscodeshift" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

$ npx -v
6.9.0
$ node -v
v10.16.0
$ npm -v
6.9.0


About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (10 by maintainers)

Most upvoted comments

My workaround was to run the command on a parent level instead of project directory. Looks like it interfered with my local packages in some way

Had to strip out the typescript but worked ok (globally install sb and react however)

For me the transformation of typescript stories worked fine, since I don‘t have any interfaces or the like defined in these files.

I needed to install the storybook cli and react globally to make the above mentioned errors disappear. Unfortunately no npx.

For me, the error was due to missing storybook cli. This command worked like a charm: npx -p @storybook/cli sb upgrade