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.

Publish to chromatic doesn't work on NPM 7

See original GitHub issue

@anthony-hull wrote (npm 7.5.3):

I was getting an empty build folder and it was hanging on the build stage. downgrading to npm install -g npm@next-6 fixed the build stage


In https://github.com/chromaui/chromatic-cli/issues/299, Ky6uk wrote:

Running npm run build-storybook manually works correctly, but npm run chromatic just hanging out after some timeout on build-storybook step.

  • Node.js: 15.10
  • NPM: 7.6.0
  • Chromatic: 5.6.3
  • Storybook 6.1.21
Starting: build-storybook -- --output-dir /tmp/chromatic--34-bm7FCFVqGuuV
node:internal/modules/cjs/loader:926
  throw err;
  ^
Error: Cannot find module '/builds/company/webapp/storybook/build-storybook'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:923:15)
    at Function.Module._load (node:internal/modules/cjs/loader:768:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
    → Command failed: build-storybook -- --output-dir /tmp/chromatic--34-bm7FCFVqGuuV

┆Issue is synchronized with this Asana task by Unito

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:16
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
cgodocommented, Apr 21, 2021

Apparently, it works if calling chromatic from local package instead of using npx: See this other’s issue comment.

I guess the issue is how npx with npm >= 7.0 runs chromatic in a different way.

Summarizing the workaround:

  1. Install Chromatic locally

npm i -D chromatic

  1. Change package.json so it runs local chromatic:

Instead of "chromatic": "npx chromatic --project-token <your-token>" put "chromatic": "chromatic --project-token <your-token>"

1reaction
anthony-hullcommented, Feb 18, 2021

Yes I was. I had run npx sb@latest upgrade before and I checked the version number against NPM for this project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setup • Chromatic docs
Setup and publish Storybook. The Chromatic CLI builds then publishes Storybook to a secure workspace in the cloud. That allows your team to...
Read more >
Chromatic Addon | Storybook: Frontend workshop for UI ...
Publishes your Storybook to Chromatic and kicks off tests if they're enabled. Published on npm Tested with Chromatic. Documentation. Read the Chromatic CLI ......
Read more >
Storybook-chromatic NPM - npm.io
Chromatic CLI. Publishes your Storybook to Chromatic and kicks off tests if they're enabled. Install. yarn add chromatic. Usage.
Read more >
Chromatic CLI not building storybook - Stack Overflow
It worked the first time and then hangs on subsequent attempts. ➜ my-project git:(storybook-poc) ✗ yarn chromatic yarn run v1.22.10 $ npx ...
Read more >
storybook-chromatic | Yarn - Package Manager
Chromatic CLI. Publishes your Storybook to Chromatic and kicks off tests if they're enabled. ... FIX setting the fromCI flag from our github...
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