Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating new medusaJs instance V2 #8419

Closed
2 tasks done
DiegoRam opened this issue Aug 2, 2024 · 13 comments · Fixed by #10179
Closed
2 tasks done

Creating new medusaJs instance V2 #8419

DiegoRam opened this issue Aug 2, 2024 · 13 comments · Fixed by #10179

Comments

@DiegoRam
Copy link

DiegoRam commented Aug 2, 2024

What Medusa version and documentation are you using?

None

Preliminary Checks

Issue Summary

Hey Guys, We have been using and testing v1, but given the pace project is getting, company decided to go V2 and implement it for an actual client.
Currently, running this command.

npx create-medusa-app@preview

Im getting this error

An error occurred while preparing project: Error: Command failed: npx medusa user -e admin@medusa-test.com --invite
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:399:5)
    at validateString (node:internal/validators:163:11)
    at join (node:path:1172:7)
    at /Users/diegoram/dev/minimalart/heb2-backend/node_modules/@medusajs/framework/dist/subscribers/subscriber-loader.js:127:50
    at Array.flatMap (<anonymous>)
    at /Users/diegoram/dev/minimalart/heb2-backend/node_modules/@medusajs/framework/dist/subscribers/subscriber-loader.js:126:32
    at async SubscriberLoader.createMap (/Users/diegoram/dev/minimalart/heb2-backend/node_modules/@medusajs/framework/dist/subscribers/subscriber-loader.js:117:26)
    at async /Users/diegoram/dev/minimalart/heb2-backend/node_modules/@medusajs/framework/dist/subscribers/subscriber-loader.js:184:20
    at async Promise.allSettled (index 0)
    at async promiseAll (/Users/diegoram/dev/minimalart/heb2-backend/node_modules/@medusajs/utils/src/common/promise-all.ts:23:18) {
  code: 'ERR_INVALID_ARG_TYPE'
}

How can this issue be resolved?

1.NA
2.
3.
...

Are you interested in working on this issue?

  • I would like to fix this issue
@shahednasser
Copy link
Member

Thank you for reporting this! Can you share your Node version?

@DiegoRam
Copy link
Author

DiegoRam commented Aug 2, 2024

Sure, 18.17

@shahednasser
Copy link
Member

Medusa requires at least Node v20. Can you try again with that version?

@DiegoRam
Copy link
Author

DiegoRam commented Aug 2, 2024

Sure, but it's not what is stated on docs. I'm willing to update it.

@shahednasser
Copy link
Member

Where do you mean it's not stated? It's stated at the very first page:

https://docs.medusajs.com/v2

@og-dev
Copy link

og-dev commented Aug 4, 2024

I am using node v20.16.0 (npm v10.8.1) and have a similar problem.

Ubuntu 20.04
node v20.16.0
MedusaJs v2 Preview

:~# medusa user -e admin@email.me -p mds2024
medusa user

Create a user

Options:
  --verbose                Turn on verbose output                                                                                       [boolean] [default: false]
  --no-color, --no-colors  Turn off the color in output                                                                                 [boolean] [default: false]
  --json                   Turn on the JSON logger                                                                                      [boolean] [default: false]
  -e, --email              User's email.                                                                                                                  [string]
  -p, --password           User's password.                                                                                                               [string]
  -i, --id                 User's id.                                                                                                                     [string]
  --invite                 If flag is set, an invitation will be created instead of a new user and the invite token will be returned.   [boolean] [default: false]
  -h, --help               Show help                                                                                                                     [boolean]
  -v, --version            Show the version of the Medusa CLI and the Medusa package in the current project                                              [boolean]
--------------- ERROR ---------------------
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received undefined
    at Module.require (node:internal/modules/cjs/loader:1226:3)
    at require (node:internal/modules/helpers:179:18)
    at resolveLocalCommand (/root/.local/share/pnpm/store/global/5/.pnpm/@medusajs+medusa-cli@1.3.23/node_modules/@medusajs/medusa-cli/dist/create-cli.js:33:20)
    at /root/.local/share/pnpm/store/global/5/.pnpm/@medusajs+medusa-cli@1.3.23/node_modules/@medusajs/medusa-cli/dist/create-cli.js:46:30
    at Object.handler (/root/.local/share/pnpm/store/global/5/.pnpm/@medusajs+medusa-cli@1.3.23/node_modules/@medusajs/medusa-cli/dist/create-cli.js:16:21)
    at Object.runCommand (/root/.local/share/pnpm/store/global/5/.pnpm/yargs@15.4.1/node_modules/yargs/build/lib/command.js:196:48)
    at Object.parseArgs [as _parseArgs] (/root/.local/share/pnpm/store/global/5/.pnpm/yargs@15.4.1/node_modules/yargs/build/lib/yargs.js:1043:55)
    at Object.parse (/root/.local/share/pnpm/store/global/5/.pnpm/yargs@15.4.1/node_modules/yargs/build/lib/yargs.js:584:29)
    at exports.default (/root/.local/share/pnpm/store/global/5/.pnpm/@medusajs+medusa-cli@1.3.23/node_modules/@medusajs/medusa-cli/dist/create-cli.js:353:10)
    at Object.<anonymous> (/root/.local/share/pnpm/store/global/5/.pnpm/@medusajs+medusa-cli@1.3.23/node_modules/@medusajs/medusa-cli/dist/index.js:38:26) {
  code: 'ERR_INVALID_ARG_TYPE'
}
-------------------------------------------
medusa user

Create a user

Options:
  --verbose                Turn on verbose output                                                                                       [boolean] [default: false]
  --no-color, --no-colors  Turn off the color in output                                                                                 [boolean] [default: false]
  --json                   Turn on the JSON logger                                                                                      [boolean] [default: false]
  -e, --email              User's email.                                                                                                                  [string]
  -p, --password           User's password.                                                                                                               [string]
  -i, --id                 User's id.                                                                                                                     [string]
  --invite                 If flag is set, an invitation will be created instead of a new user and the invite token will be returned.   [boolean] [default: false]
  -h, --help               Show help                                                                                                                     [boolean]
  -v, --version            Show the version of the Medusa CLI and the Medusa package in the current project                                              [boolean]
TypeError: cmd is not a function
    at /root/.local/share/pnpm/store/global/5/.pnpm/@medusajs+medusa-cli@1.3.23/node_modules/@medusajs/medusa-cli/dist/create-cli.js:261:13
    at /root/.local/share/pnpm/store/global/5/.pnpm/@medusajs+medusa-cli@1.3.23/node_modules/@medusajs/medusa-cli/dist/create-cli.js:48:30
    at Object.handler (/root/.local/share/pnpm/store/global/5/.pnpm/@medusajs+medusa-cli@1.3.23/node_modules/@medusajs/medusa-cli/dist/create-cli.js:16:21)
    at Object.runCommand (/root/.local/share/pnpm/store/global/5/.pnpm/yargs@15.4.1/node_modules/yargs/build/lib/command.js:196:48)
    at Object.parseArgs [as _parseArgs] (/root/.local/share/pnpm/store/global/5/.pnpm/yargs@15.4.1/node_modules/yargs/build/lib/yargs.js:1043:55)
    at Object.parse (/root/.local/share/pnpm/store/global/5/.pnpm/yargs@15.4.1/node_modules/yargs/build/lib/yargs.js:584:29)
    at exports.default (/root/.local/share/pnpm/store/global/5/.pnpm/@medusajs+medusa-cli@1.3.23/node_modules/@medusajs/medusa-cli/dist/create-cli.js:353:10)
    at Object.<anonymous> (/root/.local/share/pnpm/store/global/5/.pnpm/@medusajs+medusa-cli@1.3.23/node_modules/@medusajs/medusa-cli/dist/index.js:38:26)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)

@shahednasser
Copy link
Member

@og-dev you must be in a Medusa project before you run the medusa user command.

@olivermrbl
Copy link
Contributor

Closing this, as it is not something we can solve on our side :)

@DiegoRam
Copy link
Author

DiegoRam commented Aug 7, 2024

Where do you mean it's not stated? It's stated at the very first page:

https://docs.medusajs.com/v2

Yeah, you are right, but man is not fully updated, my bad anyway

@lemon-sandwich
Copy link

My migrations ran successfully.

npx medusa user -e admin@medusa-test.com -p supersecret
redisUrl not found. A fake redis instance will be used.
warn:    Local Event Bus installed. This is not recommended for production.
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:399:5)
    at validateString (node:internal/validators:163:11)
    at join (node:path:1176:7)
    at /home/kirmada/Developer/upwork/jon/jon/node_modules/@medusajs/framework/src/subscribers/subscriber-loader.ts:154:30
    at Array.flatMap (<anonymous>)
    at /home/kirmada/Developer/upwork/jon/jon/node_modules/@medusajs/framework/src/subscribers/subscriber-loader.ts:153:26
    at async SubscriberLoader.createMap (/home/kirmada/Developer/upwork/jon/jon/node_modules/@medusajs/framework/src/subscribers/subscriber-loader.ts:140:22)
    at async /home/kirmada/Developer/upwork/jon/jon/node_modules/@medusajs/framework/src/subscribers/subscriber-loader.ts:237:14
    at async Promise.allSettled (index 0)
    at async promiseAll (/home/kirmada/Developer/upwork/jon/jon/node_modules/@medusajs/utils/src/common/promise-all.ts:23:18) {
  code: 'ERR_INVALID_ARG_TYPE'
}

@kriss145
Copy link

I had the same problem with Node v20.0.0. Works well with Node v20.17.0

@mobeen-sarwar
Copy link

mobeen-sarwar commented Nov 20, 2024

I have the same problem.
Ubuntu 20.04
node v20.0.0

npx medusa user -e admin@medusa-test.com -p supersecret

redisUrl not found. A fake redis instance will be used.
warn:    Local Event Bus installed. This is not recommended for production.
info:    Locking module: Using "in-memory" as default.
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:399:5)
    at validateString (node:internal/validators:163:11)
    at join (node:path:1176:7)
    at /home/mobeen/www/v4medusa/node_modules/@medusajs/framework/src/subscribers/subscriber-loader.ts:154:30
    at Array.flatMap (<anonymous>)
    at /home/mobeen/www/v4medusa/node_modules/@medusajs/framework/src/subscribers/subscriber-loader.ts:153:26
    at async SubscriberLoader.createMap (/home/mobeen/www/v4medusa/node_modules/@medusajs/framework/src/subscribers/subscriber-loader.ts:140:22)
    at async /home/mobeen/www/v4medusa/node_modules/@medusajs/framework/src/subscribers/subscriber-loader.ts:237:14
    at async Promise.allSettled (index 0)
    at async promiseAll (/home/mobeen/www/v4medusa/node_modules/@medusajs/utils/src/common/promise-all.ts:23:18) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Update: I followed @kriss145 and updated Node to v22.11.0. Now it works well.

@edenjiga
Copy link

this is still happening, i dont know why you close it. im using node v22.11.0 and when I run the npx create-medusa-app@latest command

kodiakhq bot pushed a commit that referenced this issue Nov 20, 2024
What:

- `Dirent` class from `NodeJS` has different properties in different versions, causing issues in our loaders.
- Util `readDirRecursive` was introduced, avoiding old node versions to break

FIXES: #8419
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants