'Cannot find module - Error: Cannot find module

When trying to run npx sanity-codegen I get an error saying that the module don't exist. I've controlled the path in my terminal and it's there. Do I need to add something to my tsconfig?

Config:

import { SanityCodegenConfig } from 'sanity-codegen'

const config: SanityCodegenConfig = {
  schemaPath: './schemas',
  outputPath: './schema.ts',
}

export default config

Error

❯ npx sanity-codegen                      
Error: Cannot find module '/Users/user/Documents/dev/proj/system/apps/cms/schemas'
Require stack:
- /Users/user/Documents/dev/proj/system/node_modules/sanity-codegen/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at cli (/Users/user/Documents/dev/proj/system/node_modules/sanity-codegen/cli.js:100:17) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/user/Documents/dev/proj/system/node_modules/sanity-codegen/cli.js'
  ]


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source