sanity icon indicating copy to clipboard operation
sanity copied to clipboard

sanity deploy fails on github actions: Can't resolve 'react-is'

Open JGH153 opened this issue 1 year ago • 2 comments

Running sanity deploy on github actions fails with the following error:

Error: Errors while building: ./node_modules/styled-components/dist/styled-components.browser.esm.js Module not found: Error: Can't resolve 'react-is' in '/home/runner/work/curious-programming-website/curious-programming-website/sanity/node_modules/styled-components/dist'

The full action log is here: https://github.com/JGH153/curious-programming-website/runs/7556235321?check_suite_focus=true Sanity project: https://github.com/JGH153/curious-programming-website/tree/main/sanity Works locally without any problem

To Reproduce My project is open source, so the entire action can be seen here: https://github.com/JGH153/curious-programming-website/blob/723045c9d54c3a00f764ec365194ca8afab067bb/.github/workflows/deploy-sanity.yml You should be able to reproduce by just running the action on another project with sanity inside a subfolder named sanity.

Expected behavior

It should deploy without any errors.

Which versions of Sanity are you using?

@sanity/cli 2.30.2 (up to date) @sanity/base 2.30.1 (up to date) @sanity/code-input 2.30.1 (up to date) @sanity/core 2.30.2 (up to date) @sanity/default-layout 2.30.1 (up to date) @sanity/default-login 2.30.1 (up to date) @sanity/desk-tool 2.30.1 (up to date) @sanity/eslint-config-studio 2.0.0 (up to date) @sanity/vision 2.30.1 (up to date)

What operating system are you using?

Ubuntu 20.04.4 LTS

Which versions of Node.js / npm are you running?

NPM: 6.14.17 NODE: v14.20.0

JGH153 avatar Jul 28 '22 08:07 JGH153

Hi @JGH153 - it might be that your CI environment is a little stricter in how it installs dependencies - could you try adding react-is as a dependency of your project? npm install --save react-is

rexxars avatar Aug 04 '22 00:08 rexxars

For some reason, I'm also experiencing this issue on 2.30.5 and styled-components - adding react-is did the trick, but I'd rather do without this workaround. This was simply during development on macOS, once I started importing some prebuilt libraries (not even React components, just plain code).

fabien avatar Aug 21 '22 12:08 fabien

Sorry for the late reply. Adding react-is as a dependency as a workaround solved the problem, thanks @rexxars!

JGH153 avatar Sep 28 '22 07:09 JGH153

I don't see how this is resolved by using a workaround?

fabien avatar Sep 28 '22 07:09 fabien