medusa: TypeError: cmd is not a function
This error appears during ‘medusa develop’
TypeError: cmd is not a function
at /usr/lib/node_modules/@medusajs/medusa-cli/dist/create-cli.js:260:7
at /usr/lib/node_modules/@medusajs/medusa-cli/dist/create-cli.js:108:24
at Object.handler (/usr/lib/node_modules/@medusajs/medusa-cli/dist/create-cli.js:54:24)
at Object.runCommand (/usr/lib/node_modules/@medusajs/medusa-cli/node_modules/yargs/build/lib/command.js:196:48)
at Object.parseArgs [as _parseArgs] (/usr/lib/node_modules/@medusajs/medusa-cli/node_modules/yargs/build/lib/yargs.js:1043:55)
at Object.parse (/usr/lib/node_modules/@medusajs/medusa-cli/node_modules/yargs/build/lib/yargs.js:584:29)
at module.exports (/usr/lib/node_modules/@medusajs/medusa-cli/dist/create-cli.js:392:6)
at Object.<anonymous> (/usr/lib/node_modules/@medusajs/medusa-cli/dist/index.js:70:27)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
-bash-4.2# uname -a Linux ip-10-0-82-92.us-west-2.compute.internal 4.14.248-189.473.amzn2.x86_64 #1 SMP Mon Sep 27 05:52:26 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 7
- Comments: 24 (6 by maintainers)
If you are using the official documentation and created the project using npx create-medusa-app
and if your folder structure is similar to below
Run the medusa commands inside the /backend folder. This solves my issue
DIFFERENT SOLUTION FOR THOSE ASKING FOR HELP WITH
medusa user ...
for those who is getting error while running
medusa user ...
, just change your terminal folder to ./my-medusa-store and than run same script. Problem is thatmedusa
script tryng to run some packages locally from deps and in medusa-admin/node_modules are missing those deps. Is even written in the doc above the scriptHappy codding
FWIW I ran into this error too when setting up MinIO. TLDR I think (in my case) it’s a conflict with yarn v3+. I fixed the error by undoing the
yarn add
and re-installing withnpm
.Steps to reproduce: (MacOS and node v16)
medusa new ...
yarn add medusa-file-minio
(in my case with yarn v3.2.3), and add MinIO stuff to.env
andmedusa-config.js
.medusa develop
To fix the error:
yarn remove medusa-file-minio
npm install medusa-file-minio
medusa develop
Getting the same error on “medusa user”, works fine on “medusa” alone.
That worked, I had to use a module called n to get it to use the latest node instead of stable. Thanks