blitz-js / blitz-js/legacy-framework
Blitz does not run after reinstalling node_modules
- Dominant language
- JavaScript
- Stars
- 3
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
### 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. (/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.

Contributor guide
Research direction
Reproduce the failure with `npx blitz new`, deleting `node_modules`, and running `npm i`; the log points to `scripts/postinstall.js` and the missing `.blitz` module. Trace the postinstall path and verify that a clean reinstall recreates `.blitz` and completes without the `MODULE_NOT_FOUND` error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nextjs, nodejs
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100