blitz-js / legacy-framework

MIT License
3 stars 2 forks source link

Global CLI not working with pnpm #18

Closed taep96 closed 11 months ago

taep96 commented 3 years ago

What is the problem?

I created a new blitz app with blitz new pnpm (blitz installed globally). Vscode jest extension fails to run tests and I am getting errors after running blitz dev using global module, but if I run the app using locally installed module (pnpm dev) it still logs the errors, now in different format, and runs.

Paste all your error logs here:

~\desktop\pnpm main ≢  1.813s
❯ blitz dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Loaded env from C:\Users\Nizomidin\desktop\pnpm\.env.local
info  - Loaded env from C:\Users\Nizomidin\desktop\pnpm\.env
Error: Cannot find module '.blitz'
Require stack:
- C:\Users\Nizomidin\desktop\pnpm\node_modules\.pnpm\@blitzjs+core@0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\node_modules\@blitzjs\core\dist\blitzjs-core.cjs.dev.js
- C:\Users\Nizomidin\desktop\pnpm\node_modules\.pnpm\@blitzjs+core@0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\node_modules\@blitzjs\core\dist\blitzjs-core.cjs.js
- C:\Users\Nizomidin\desktop\pnpm\node_modules\.pnpm\blitz@0.41.1_36c5d53d03be96726e49ef745d3805fc\node_modules\blitz\dist\blitz.cjs.dev.js
- C:\Users\Nizomidin\desktop\pnpm\node_modules\.pnpm\blitz@0.41.1_36c5d53d03be96726e49ef745d3805fc\node_modules\blitz\dist\blitz.cjs.js
- C:\Users\Nizomidin\desktop\pnpm\.blitz.config.compiled.js
- C:\Users\Nizomidin\desktop\pnpm\node_modules\.pnpm\@blitzjs+next@11.1.0-0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\node_modules\@blitzjs\next\dist\server\config.js
- C:\Users\Nizomidin\desktop\pnpm\node_modules\.pnpm\@blitzjs+next@11.1.0-0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\node_modules\@blitzjs\next\dist\server\next.js
- C:\Users\Nizomidin\desktop\pnpm\node_modules\.pnpm\@blitzjs+next@11.1.0-0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\node_modules\@blitzjs\next\dist\server\lib\start-server.js
- C:\Users\Nizomidin\desktop\pnpm\node_modules\.pnpm\@blitzjs+next@11.1.0-0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\node_modules\@blitzjs\next\dist\cli\next-dev.js
- C:\Users\Nizomidin\desktop\pnpm\node_modules\.pnpm\@blitzjs+next@11.1.0-0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\node_modules\@blitzjs\next\dist\bin\next
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.mod._resolveFilename (C:\Users\Nizomidin\desktop\pnpm\node_modules\.pnpm\@blitzjs+next@11.1.0-0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\node_modules\@blitzjs\next\dist\build\webpack\require-hook.js:96:28)
    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 Object.<anonymous> (C:\Users\Nizomidin\desktop\pnpm\node_modules\.pnpm\@blitzjs+core@0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\node_modules\@blitzjs\core\dist\blitzjs-core.cjs.dev.js:18:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Nizomidin\\desktop\\pnpm\\node_modules\\.pnpm\\@blitzjs+core@0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\\node_modules\\@blitzjs\\core\\dist\\blitzjs-core.cjs.dev.js',
    'C:\\Users\\Nizomidin\\desktop\\pnpm\\node_modules\\.pnpm\\@blitzjs+core@0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\\node_modules\\@blitzjs\\core\\dist\\blitzjs-core.cjs.js',
    'C:\\Users\\Nizomidin\\desktop\\pnpm\\node_modules\\.pnpm\\blitz@0.41.1_36c5d53d03be96726e49ef745d3805fc\\node_modules\\blitz\\dist\\blitz.cjs.dev.js',
    'C:\\Users\\Nizomidin\\desktop\\pnpm\\node_modules\\.pnpm\\blitz@0.41.1_36c5d53d03be96726e49ef745d3805fc\\node_modules\\blitz\\dist\\blitz.cjs.js',
    'C:\\Users\\Nizomidin\\desktop\\pnpm\\.blitz.config.compiled.js',
    'C:\\Users\\Nizomidin\\desktop\\pnpm\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\\node_modules\\@blitzjs\\next\\dist\\server\\config.js',
    'C:\\Users\\Nizomidin\\desktop\\pnpm\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\\node_modules\\@blitzjs\\next\\dist\\server\\next.js',
    'C:\\Users\\Nizomidin\\desktop\\pnpm\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\\node_modules\\@blitzjs\\next\\dist\\server\\lib\\start-server.js',
    'C:\\Users\\Nizomidin\\desktop\\pnpm\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\\node_modules\\@blitzjs\\next\\dist\\cli\\next-dev.js',
    'C:\\Users\\Nizomidin\\desktop\\pnpm\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.41.1_4833af42bc1bc66e9c1c1c773f6c88ca\\node_modules\\@blitzjs\\next\\dist\\bin\\next'
  ]
}

Paste all relevant code snippets here:

Nothing changed.

What are detailed steps to reproduce this?

  1. pnpm add -g blitz
  2. blitz new pnpm (pnpm is the project name)
  3. select pnpm as package manager
  4. select react final form
  5. cd pnpm
  6. blitz dev or pnpm dev

Run blitz -v and paste the output here:

Windows 10 | win32-x64 | Node: v14.18.1

blitz: 0.41.1 (global)
blitz: 0.41.1 (local)

  Package manager: npm
  System:
    OS: Windows 10 10.0.19043
    CPU: (4) x64 AMD Ryzen 3 2200G with Radeon Vega Graphics
    Memory: 864.86 MB / 5.93 GB
  Binaries:
    Node: 14.18.1 - C:\TEMP\fnm_multishells\11980_1634302005923\node.EXE
    Yarn: 1.22.15 - C:\TEMP\fnm_multishells\11980_1634302005923\yarn.CMD
    npm: 6.14.15 - C:\TEMP\fnm_multishells\11980_1634302005923\npm.CMD
    Watchman: Not Found
  npmPackages:
    @prisma/client: 3.2.1 => 3.2.1
    blitz: 0.41.1 => 0.41.1
    prisma: 3.2.1 => 3.2.1
    react: alpha => 18.0.0-alpha-c3a19e5af-20211014
    react-dom: alpha => 18.0.0-alpha-c3a19e5af-20211014
    typescript: ~4.3 => 4.3.5

Please include below any other applicable logs and screenshots that show your problem:

21_10_15_52_obkb14VRiL_WindowsTerminal with blitz dev

image with pnpm dev

flybayer commented 3 years ago

I knew that the global cli wasn't working with pnpm, but pnpm dev is working on mac. Looks like that must be broken on windows.

So technically there are two issues here, probably should separate them. (1) global cli doesn't work on any platform with pnpm and (2) pnpm totally broken on windows

taep96 commented 3 years ago

Second issue is on pnpm then? Should I edit the title?

flybayer commented 3 years ago

@LemonJuicer96 sorry for the delay here. Can you change this issue to only focus on the first problem and open a second one for the other problem?