percy-storybook: broken after @percy/cli v1.0.1 upgrade

after upgrading to the latest version of @percy/cli I’m running into this error:

$ yarn percy storybook ./storybook-static --verbose
yarn run v1.22.10
$ /path/to/node_modules/.bin/percy storybook ./storybook-static --verbose
[percy] Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/path/to/node_modules/@percy/storybook/dist/hooks/init' imported from /path/to/node_modules/@percy/cli/dist/commands.js
Did you mean to import /path/to/node_modules/@percy/storybook/dist/hooks/init.js?
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I’m unsure if I should report this here or in https://github.com/percy/cli but if I uninstall @percy/storybook the cli seems to work correctly:

$ yarn percy --help
yarn run v1.22.10
Usage:
  $ percy <command>

Commands:
  exec [options] -- <command>                   Start and stop Percy around a supplied command
  exec:start [options]                          Starts a local Percy snapshot server
  exec:stop [options]                           Stops a local running Percy snapshot server
  exec:ping [options]                           Pings a local running Percy snapshot server
  snapshot [options] <dir|file|sitemap>         Snapshot a static directory, snapshots file, or sitemap URL
  upload [options] <dirname>                    Upload a directory of images to Percy
  build:finalize [options]                      Finalize parallel Percy builds
  build:wait [options]                          Wait for a build to be finished
  config:create [options] [filepath]            Create a Percy config file
  config:validate [options] [filepath]          Validate a Percy config file
  config:migrate [options] [filepath] [output]  Migrate a Percy config file to the latest version
  help [command]                                Display command help

Global options:
  -v, --verbose                                 Log everything
  -q, --quiet                                   Log errors only
  -s, --silent                                  Log nothing
  -h, --help                                    Display command help
  -V, --version                                 Display version

✨  Done in 0.70s.

but after installing @percy/storybook I get the same error:

$ yarn percy --help
yarn run v1.22.10
$ /path/to/node_modules/.bin/percy --help
[percy] Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/path/to/node_modules/@percy/storybook/dist/hooks/init' imported from /path/to/node_modules/@percy/cli/dist/commands.js
Did you mean to import /path/to/node_modules/@percy/storybook/dist/hooks/init.js?
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 20 (5 by maintainers)

Most upvoted comments

@Robdel12 I can confirm this fixed the issue for me, thank you for the quick turnaround! 🙏

@Robdel12 I can confirm this fixed the issue for me, thank you for the quick turnaround! 🙏

Same here! Thanks again!

Alrighty y’all, upgrading to 4.2.0 will fix these issues 🎉 https://github.com/percy/percy-storybook/releases/tag/v4.2.0

I think the root of the issue is mostly that these packages aren’t following the standard semver format for npm/yarn.

This is not true. Breaking changes can be made for anything with a pre-release tag or non-major (1.0.0-beta.1 or 0.x.x). We made our final breaking changes prior to 1.x release. One of those breaking changes was to drop Node 12, which is EOL this month. All other SDKs needed a bug bump to update them to Node 14, which aligns them with the breaking change the CLI has. Again, you’re not forced to upgrade immediately. If you’re not using a lockfile of some sort, I highly recommend doing so. This will prevent any of your dependencies shifting under you. The lockfile shouldn’t change unless you make specific dependency updates. And in those cases, you can revert the lock file.

The storybook SDK on the other hand needs an update which will fix the config schema change we made upstream https://github.com/percy/cli/pull/804. That + aligning this SDK with Node 14 will be coming this week.

Yes, this seems to work for us, but you need to pin all the Percy packages to beta:

Yep, it does! Here’s what we did for npm overrides:

{
  "overrides": {
    "@percy/cli-build": "1.0.0-beta.76",
    "@percy/cli-command": "1.0.0-beta.76",
    "@percy/cli-config": "1.0.0-beta.76",
    "@percy/cli-exec": "1.0.0-beta.76",
    "@percy/cli-snapshot": "1.0.0-beta.76",
    "@percy/cli-upload": "1.0.0-beta.76",
    "@percy/cli": "1.0.0-beta.76",
    "@percy/client": "1.0.0-beta.76",
    "@percy/config": "1.0.0-beta.76",
    "@percy/core": "1.0.0-beta.76",
    "@percy/dom": "1.0.0-beta.76",
    "@percy/env": "1.0.0-beta.76",
    "@percy/logger": "1.0.0-beta.76"
  }
}

Thanks @okize and @bartaz!

Hey @tmcconechy can you open a discussion on the appropriate SDK with more details?

Thanks, @Robdel12. Looking forward to it. Appreciate your work on this

I’m having the same problem, for several projects actually. It would be great if somebody could have a look into what’s going on 😃