medusajs / medusa

Building blocks for digital commerce
https://medusajs.com
MIT License
24.75k stars 2.44k forks source link

Create-medusa-app 1.2.9-preview crashes upon launch due to missing graphql module #9291

Closed zohfur closed 1 hour ago

zohfur commented 12 hours ago

Bug report

Describe the bug

Upon trying to run npx create-medusa-app@preview, npx installs create-medusa-app@1.2.9-preview-20240924183656 which promptly crashes.

System information

Medusa version (including plugins): create-medusa-app@1.2.9-preview-20240924183656 Node.js version: v22.8.0 Database: postgres:12.20-alpine3.20 Operating system: Windows 11 Pro build 22631

Steps to reproduce the behavior

  1. Run npx create-medusa-app@preview or npx create-medusa-app@1.2.9-preview-20240924183656
  2. Enter Y to proceed with package installation.
  3. Error: Cannot find module 'graphql'

Code snippets


PS C:\Users\herat> npx create-medusa-app@preview
Need to install the following packages:
create-medusa-app@1.2.9-preview-20240924183656
Ok to proceed? (y) y

npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated glob@8.1.0: Glob versions prior to v9 are no longer supported
╔════════════════════════════════════════════════════════════════════════╗
║                                                                        ║
║   Medusa collects anonymous usage analytics                            ║
║   to help improve Medusa for all users.                                ║
║                                                                        ║
║   If you'd like to opt-out, you can use `medusa telemetry --disable`   ║
║                                                                        ║
║                                                                        ║
╚════════════════════════════════════════════════════════════════════════╝
node:internal/modules/cjs/loader:1248
              ^

Error: Cannot find module 'graphql'
Require stack:
- C:\Users\USER\AppData\Local\npm-cache\_npx\faeeb6a9cda0cafd\node_modules\@medusajs\utils\dist\common\graphql-relations-entity-map.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Module._load (node:internal/modules/cjs/loader:1074:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (C:\Users\USER\AppData\Local\npm-cache\_npx\faeeb6a9cda0cafd\node_modules\@medusajs\utils\dist\common\graphql-relations-entity-map.js:4:19)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\USER\\AppData\\Local\\npm-cache\\_npx\\faeeb6a9cda0cafd\\node_modules\\@medusajs\\utils\\dist\\common\\graphql-relations-entity-map.js'
  ]
}

Node.js v22.8.0```
zohfur commented 12 hours ago

Issue is resolved by installing graphql via npm install graphql, but https://docs.medusajs.com/v2 does not label this as a requirement / prerequisite and the script does not install it on its own, so still a bug IMO.

adambarath commented 4 hours ago

Issue is resolved by installing graphql via npm install graphql, but https://docs.medusajs.com/v2 does not label this as a requirement / prerequisite and the script does not install it on its own, so still a bug IMO.

I had the same issue. Did not solved the issue installig npm install graphql neither npm install -g graphql . I copied manually the graphql directory into preview package installation cache. For example:

  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\USER\\AppData\\Local\\npm-cache\\_npx\\faeeb6a9cda0cafd\\node_modules\\@medusajs\\utils\\dist\\common\\graphql-relations-entity-map.js'
  ]

The target folder where you may copy the graphql package would be: C:\\Users\\USER\\AppData\\Local\\npm-cache\\_npx\\faeeb6a9cda0cafd\\node_modules.

I hope this workaround will help.

shahednasser commented 3 hours ago

Thank you for reporting this. We're looking to resolve this issue soon and push out a new release to fix it

shahednasser commented 2 hours ago

Issue should be fixed now, can you try again?

adambarath commented 2 hours ago

Issue should be fixed now, can you try again?

I can confirim the latest prview release's installation process works as expected. (create-medusa-app@1.2.9-preview-20240925062017)

shahednasser commented 1 hour ago

Great thanks! WIll close this issue, feel free to re-open it @zohfur if you keep facing it.