blitz-js / legacy-framework

MIT License
2 stars 2 forks source link

Blitz does not run after reinstalling node_modules #10

Open dhythm opened 2 years ago

dhythm commented 2 years ago

What is the problem?

I create a new project by npx blitz new xxx, the node_modules has .blitz dir. However, .blitz is gone after I delete node_modules and run npm install again.

Then, I catch an error below.

Thanks you for your kind help 🙏

Paste all your error logs here:

> blitz@0.44.4 postinstall /Users/y-okada/local/blitz-sample2/node_modules/blitz
> node scripts/postinstall.js

internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module '.blitz'
Require stack:
- /Users/y-okada/local/blitz-sample2/node_modules/next/dist/stdlib/index.js
- /Users/y-okada/local/blitz-sample2/node_modules/next/stdlib.js
- /Users/y-okada/local/blitz-sample2/node_modules/blitz/dist/blitz.cjs.dev.js
- /Users/y-okada/local/blitz-sample2/node_modules/blitz/dist/blitz.cjs.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/y-okada/local/blitz-sample2/node_modules/next/dist/stdlib/index.js:85:14)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/y-okada/local/blitz-sample2/node_modules/next/dist/stdlib/index.js',
    '/Users/y-okada/local/blitz-sample2/node_modules/next/stdlib.js',
    '/Users/y-okada/local/blitz-sample2/node_modules/blitz/dist/blitz.cjs.dev.js',
    '/Users/y-okada/local/blitz-sample2/node_modules/blitz/dist/blitz.cjs.js'
  ]
}

Paste all relevant code snippets here:

nothing to add after blitz new

What are detailed steps to reproduce this?

  1. npx blitz new blitz-sample2
  2. delete node_modules
  3. npm i

Run blitz -v and paste the output here:

Loaded env from /Users/y-okada/local/blitz-sample2/.env.local
Loaded env from /Users/y-okada/local/blitz-sample2/.env
macOS Catalina | darwin-x64 | Node: v14.15.4

blitz: 0.44.4 (local)

  Package manager: npm 
  System:
    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 979.63 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.15.4 - ~/.anyenv/envs/nodenv/versions/14.15.4/bin/node
    Yarn: 1.22.11 - ~/.anyenv/envs/nodenv/versions/14.15.4/bin/yarn
    npm: 6.14.10 - ~/.anyenv/envs/nodenv/versions/14.15.4/bin/npm
    Watchman: 2021.06.07.00 - /usr/local/bin/watchman
  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 

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

After running npm i again. image

beerose commented 2 years ago

Hi @dhythm!

It does like an issue (reproduced it with npm), and the current workaround would be to run blitz codegen after npm install to generate the .blitz directory.

dhythm commented 2 years ago

Hi @beerose ! Thanks for your comment! I confirm .blitz is created via blitz codegen 👍

beerose commented 2 years ago

Observations: