Structured Content 2022: Join our conference to explore fresh perspectives on content and digital experiences →

I’m experiencing an error when trying to deploy `sanity graphql deploy` and getting this error point towards a node_module ```import ColorPicker from '../components/input'; ^^^^^^ SyntaxErro...

17 replies
Last updated: Jan 16, 2021

I’m experiencing an error when trying to deploy

sanity graphql deploy
and getting this error point towards a node_module
import ColorPicker from '../components/input';
^^^^^^
SyntaxError: Cannot use import statement outside a module
Does anyone know what’s causing this issue. I have been fine with this studio until the moment.

Jan 15, 2021, 4:41 AM

It would appear so, but I can't see any direct imports in the published package... Could you paste the output of what

sanity versions
gives you when you run it in the studio folder?

Jan 15, 2021, 4:49 AM

@sanity/cli 2.1.4 (up to date)@sanity/base 2.1.6 (up to date)
@sanity/cli 2.1.4 (up to date)
@sanity/color-input 2.1.4 (up to date)
@sanity/components 2.1.4 (up to date)
@sanity/core 2.1.4 (up to date)
@sanity/default-layout 2.1.6 (up to date)
@sanity/default-login 2.1.4 (up to date)
@sanity/desk-tool 2.1.6 (up to date)
@sanity/vision 2.1.4 (up to date)

Jan 15, 2021, 4:51 AM

/Users/dustinsimensen/Documents/Final/studio/node_modules/sanity-plugin-color-picker/lib/schema/index.js:82
import ColorPicker from '../components/input';
^^^^^^
SyntaxError: Cannot use import statement outside a module

Jan 15, 2021, 4:51 AM

thats the full error

Jan 15, 2021, 4:51 AM

I had to completely remove it to move on

Jan 15, 2021, 4:57 AM

Oh, I see,

sanity-plugin-color-picker
is a community-contributed plugin - it seems to not compile the javascript sources to ES5 😕
I'll see if I can send a pull request to fix it, but I can't guarantee a swift resolution given it's not an official plugin

Jan 15, 2021, 5:02 AM

That’s okay, I don’t know why it’s there, honestly?

Jan 15, 2021, 5:03 AM

I just deleted it and two pieces of code that used it and didn’t do anything. Thanks.

Jan 15, 2021, 5:03 AM

I'm not sure? Was this project based on one of our starters?

Jan 15, 2021, 5:12 AM

It was not, no.

Jan 15, 2021, 5:12 AM

A teammate put the code in last night and it crashed my sanity

Jan 15, 2021, 5:12 AM

Aha

Jan 15, 2021, 5:13 AM

May I ask an unrelated question about Sanity Images inside the CMS?

Jan 15, 2021, 5:15 AM

Or should I ask in main channel?

Jan 15, 2021, 5:16 AM

Main channel would be best 🙂

Jan 15, 2021, 5:24 AM

Main channel would be best 🙂

Jan 15, 2021, 5:24 AM

[ for what it's worth, this is now fixed in the latest release of the mentioned plugin - https://github.com/edolyne/sanity-plugin-color-picker/pull/2 ]

Jan 16, 2021, 4:16 AM

Sanity.io: Get the most out of your content

Sanity.io is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Give your team exactly what they need to edit and publish their content with the customizable Sanity Studio. Get real-time collaboration out of the box. Sanity.io comes with a hosted datastore for JSON documents, query languages like GROQ and GraphQL, CDNs, on-demand asset transformations, presentation agnostic rich text, plugins, and much more.

Don't compromise on developer experience. Join thousands of developers and trusted companies and power your content with Sanity.io. Free to get started, pay-as-you-go on all plans.