Installing Mux with Sanity v2 - compatibility issues

5 replies
Last updated: Feb 14, 2024
Has anyone successfully installed and using Mux in a project based on Sanity v2? I’ve tried to install it for over an hour now, and it won’t work..
AI Update

I can see you're struggling with installing the Mux plugin for Sanity v2. This is actually a known issue because Sanity v2 is now deprecated, and the plugin ecosystem has moved on to support Sanity Studio v3.

The good news is that there's still a working version for v2, but you need to install it specifically. Here's what you need to do:

For Sanity Studio v2

Install the Studio v2 version explicitly using the @studio-v2 tag:

yarn add sanity-plugin-mux-input@studio-v2

or with npm:

npm install sanity-plugin-mux-input@studio-v2

The Studio v2 README has specific instructions for the v2 version.

Common Installation Issues

If you're still having trouble, here are some things to check:

  1. Package name confusion: The package is called sanity-plugin-mux-input, not @sanity/mux-input (which was the old deprecated name)

  2. Mux API credentials: Make sure you have your Mux Access Token and Secret Key ready. You'll need to generate these from your Mux dashboard with permissions for both read/write video and read data.

  3. Schema configuration: After installing, you need to add it to your schema. For v2, this looks like:

{
  title: 'Video',
  name: 'video',
  type: 'mux.video'
}
  1. Signing key issues: One common problem is an incorrect signing key in your Mux configuration. If your uploads are failing, double-check that your Mux Access Token has the correct permissions and that you're using the right signing key.

Consider Upgrading to Studio v3

Since you're having installation issues anyway, this might be a good time to consider upgrading to Sanity Studio v3. The current version of the plugin (sanity-plugin-mux-input) is actively maintained for v3, and you'll have much better support going forward. Studio v2 reached end-of-life, so you'll increasingly run into compatibility issues with newer tools and dependencies.

For Studio v3, the installation is simpler:

npm install sanity-plugin-mux-input

Then add it to your sanity.config.ts:

import {defineConfig} from 'sanity'
import {muxInput} from 'sanity-plugin-mux-input'

export default defineConfig({
  plugins: [muxInput()],
})

If you share more details about the specific error messages you're seeing during installation, I can help troubleshoot further!

Show original thread
5 replies
Is there a chance you’re using the v3 install command instead of the v2?
No, I’ve been following the instructions on the Github page, but it’s giving me errors either on some styled components (which goes away if I remove the plugin) or it won’t find the v2-version
I installed the older version of styled-components in order to get the Mux plugin to work. (I’m on Sanity V3 though).
user C
Oh, that sounds like an option I need to try! What version of styled components did you downgrade to?
“styled-components”: “^5.2”
Worked for me! Hope that helps :)

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?