blitz-js / legacy-framework

MIT License
3 stars 2 forks source link

"Error: Cannot find module 'blitz'" when installing with pnpm #172

Closed valerii15298 closed 2 years ago

valerii15298 commented 2 years ago

What is the problem?

I followed the steps from the documentation "get started" section.

And when I run blitz dev i got the error: Error: Cannot find module '.blitz' Is there a workaround for it?

Paste all your error logs here:

PS C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1> blitz dev
Loaded env from C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\.env.local
Loaded env from C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\.env
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
node:internal/modules/cjs/loader:933
  const err = new Error(message);
              ^

Error: Cannot find module '.blitz'
Require stack:
- C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\node_modules\.pnpm\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\node_modules\@blitzjs\next\dist\stdlib\index.js
- C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\node_modules\.pnpm\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\node_modules\@blitzjs\next\dist\data-client\auth.js
- C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\node_modules\.pnpm\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\node_modules\@blitzjs\next\dist\stdlib\blitz-app-root.js
- C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\node_modules\.pnpm\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\node_modules\@blitzjs\next\dist\server\render.js
- C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\node_modules\.pnpm\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\node_modules\@blitzjs\next\dist\server\next-server.js
- C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\node_modules\.pnpm\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\node_modules\@blitzjs\next\dist\server\next.js
- C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\node_modules\.pnpm\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\node_modules\@blitzjs\next\dist\server\lib\start-server.js
- C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\node_modules\.pnpm\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\node_modules\@blitzjs\next\dist\cli\next-dev.js
- C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\node_modules\.pnpm\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\node_modules\@blitzjs\next\dist\bin\next
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\node_modules\.pnpm\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\node_modules\@blitzjs\next\dist\stdlib\index.js:85:14)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\valer\\OneDrive\\Desktop\\projects\\blitz-projects\\myAppName1\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\\node_modules\\@blitzjs\\next\\dist\\stdlib\\index.js',
    'C:\\Users\\valer\\OneDrive\\Desktop\\projects\\blitz-projects\\myAppName1\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\\node_modules\\@blitzjs\\next\\dist\\data-client\\auth.js',
    'C:\\Users\\valer\\OneDrive\\Desktop\\projects\\blitz-projects\\myAppName1\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\\node_modules\\@blitzjs\\next\\dist\\stdlib\\blitz-app-root.js',
    'C:\\Users\\valer\\OneDrive\\Desktop\\projects\\blitz-projects\\myAppName1\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\\node_modules\\@blitzjs\\next\\dist\\server\\render.js',
    'C:\\Users\\valer\\OneDrive\\Desktop\\projects\\blitz-projects\\myAppName1\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\\node_modules\\@blitzjs\\next\\dist\\server\\next-server.js',
    'C:\\Users\\valer\\OneDrive\\Desktop\\projects\\blitz-projects\\myAppName1\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\\node_modules\\@blitzjs\\next\\dist\\server\\next.js',
    'C:\\Users\\valer\\OneDrive\\Desktop\\projects\\blitz-projects\\myAppName1\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\\node_modules\\@blitzjs\\next\\dist\\server\\lib\\start-server.js',
    'C:\\Users\\valer\\OneDrive\\Desktop\\projects\\blitz-projects\\myAppName1\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\\node_modules\\@blitzjs\\next\\dist\\cli\\next-dev.js',
    'C:\\Users\\valer\\OneDrive\\Desktop\\projects\\blitz-projects\\myAppName1\\node_modules\\.pnpm\\@blitzjs+next@11.1.0-0.44.4_43729cc2d5bc75718e6eeea3856524ae\\node_modules\\@blitzjs\\next\\dist\\bin\\next'
  ]
}

Node.js v17.3.0
PS C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1>

What are detailed steps to reproduce this?

yarn global add blitz
blitz new myAppName
cd myAppName
blitz dev

When creating app I chose package manager pnpm, language - typescript, and all others options as recommended.

Run blitz -v and paste the output here:

PS C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1> blitz -v
Loaded env from C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\.env.local
Loaded env from C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1\.env
Windows 10 | win32-x64 | Node: v17.3.0

blitz: 0.44.4 (global)
blitz: 0.44.4 (local)

  Package manager: npm
  System:
    OS: Windows 10 10.0.22000
    CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
    Memory: 8.34 GB / 15.36 GB
  Binaries:
    Node: 17.3.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.3.0 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  npmPackages:
    @prisma/client: 3.7.0 => 3.7.0
    blitz: 0.44.4 => 0.44.4
    prisma: 3.7.0 => 3.7.0
    react: 18.0.0-beta-149b420f6-20211119 => 18.0.0-beta-149b420f6-20211119
    react-dom: 18.0.0-alpha-5ca4b0433-20211020 => 18.0.0-alpha-5ca4b0433-20211020
    typescript: ~4.5 => 4.5.4

PS C:\Users\valer\OneDrive\Desktop\projects\blitz-projects\myAppName1>

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

No response

beerose commented 2 years ago

Hi @valerii15298, sorry for the delay in responding. Unfortunately, it looks like global CLI is not working on Windows with pnpm. Here's a related issue: https://github.com/blitz-js/legacy-framework/issues/18.

I'm closing this one in favor of https://github.com/blitz-js/legacy-framework/issues/18.