Anyone got blitz running inside a mono repo.. I tried to setup a monorepo with both rushjs and Lerna with yarn workspaces.. getting following error with Lerna
Error: Cannot find module '/Users/johndoe/Workspace/projects/blitz-lerna/node_modules/date-fns/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:323:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:681:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:944:27)
at Function._load (/Users/johndoe/Workspace/projects/blitz-lerna/node_modules/@salesforce/lazy-require/lib/LazyLoader.js:112:42)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (/Users/johndoe/Workspace/projects/blitz-lerna/node_modules/@blitzjs/cli/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/Users/johndoe/Workspace/projects/blitz-lerna/node_modules/@blitzjs/server/dist/server.cjs.development.js:39:15)
at Module._compile (/Users/johndoe/Workspace/projects/blitz-lerna/node_modules/@blitzjs/cli/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32) {
code: 'MODULE_NOT_FOUND',
path: '/Users/johndoe/Workspace/projects/blitz-lerna/node_modules/date-fns/package.json',
requestPath: 'date-fns'
}
Please clone the following repo https://github.com/developer-rakeshpaul/blitz-lerna.git
npx lerna bootstrap
try running blitz app using yarn start from packages/web folder
output of `blitz --version --verbose`
macOS Catalina | darwin-x64 | Node: v12.16.3
blitz: 0.25.0-canary.1 (local)
Package manager: npm
System:
OS: macOS 10.15.7
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 379.16 MB / 16.00 GB
Shell: 3.0.2 - /usr/local/bin/fish
Binaries:
Node: 12.16.3 - ~/.config/nvm/12.16.3/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.config/nvm/12.16.3/bin/npm
Watchman: Not Found
npmPackages:
@prisma/cli: Not Found
@prisma/client: Not Found
blitz: Not Found
react: 0.0.0-experimental-7f28234f8 => 0.0.0-experimental-7f28234f8
react-dom: 0.0.0-experimental-7f28234f8 => 0.0.0-experimental-7f28234f8
typescript: Not Found
@developer-rakeshpaul looks like you forgot to push some commits to that repo (no blitz app in web). But I added a blitz app to the web folder myself to test, and it is working fine. I'm unable to reproduce your error.
I same with flybayer.
@flybayer @nitaking not sure what happened with the checkin. I am still facing the issue.. I have updated the packages with a newly created blitz app.. run npx blitz new web in the mono repo to create a new project I am still getting the same error
Error: Cannot find module '/Users/johndoe/Workspace/projects/blitz-lerna/node_modules/date-fns/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:323:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:681:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:944:27)
at Function._load (/Users/johndoe/Workspace/projects/blitz-lerna/node_modules/@salesforce/lazy-require/lib/LazyLoader.js:112:42)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (/Users/johndoe/Workspace/projects/blitz-lerna/node_modules/@blitzjs/cli/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/Users/johndoe/Workspace/projects/blitz-lerna/node_modules/@blitzjs/server/dist/server.cjs.development.js:39:15)
at Module._compile (/Users/johndoe/Workspace/projects/blitz-lerna/node_modules/@blitzjs/cli/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32) {
code: 'MODULE_NOT_FOUND',
path: '/Users/johndoe/Workspace/projects/blitz-lerna/node_modules/date-fns/package.json',
requestPath: 'date-fns'
}
debug: blitzPkgPath: /Users/johndoe/Workspace/projects/blitz-lerna/node_modules/blitz/dist/index.js
debug: cliPkgPath: /Users/johndoe/Workspace/projects/blitz-lerna/node_modules/@blitzjs/cli/lib/src/index.js
macOS Catalina | darwin-x64 | Node: v12.16.3
blitz: 0.25.0-canary.1 (local)
Package manager: npm
System:
OS: macOS 10.15.7
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 188.48 MB / 16.00 GB
Shell: 3.0.2 - /usr/local/bin/fish
Binaries:
Node: 12.16.3 - ~/.config/nvm/12.16.3/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.config/nvm/12.16.3/bin/npm
Watchman: Not Found
npmPackages:
@prisma/cli: Not Found
@prisma/client: Not Found
blitz: Not Found
react: 0.0.0-experimental-7f28234f8 => 0.0.0-experimental-7f28234f8
react-dom: 0.0.0-experimental-7f28234f8 => 0.0.0-experimental-7f28234f8
typescript: 4.0.5 => 4.0.5
@developer-rakeshpaul do you have yarn installed?
@flybayer Yes I do
~/W/p/b/p/web (master | 👍 ) ❯❯❯ yarn --version
1.22.10
even tried reinstalling yarn for peace of mind
if you look at npmPackages it shows blitz as not found.. is it because I don't have blitz installed globally.
I get the same "not found" for blitz (because npxenv doesn't work with monorepo apparently for version detection).
Not sure what to to tell you to try at this point 🤷
@flybayer how you got it working earlier?
@developer-rakeshpaul it just works fine for me, including what you have pushed up now.
@flybayer which node version are you using?
v12.16.1
@flybayer tried to run the same setup on my friends machine and he was getting styled-jsx missing error... I couldn't grab the version info but there seems to be some inconsistency in the way it works with monorepos..
Ok seems there's some issues here. I marked as a bug and ready for someone to work on.
I am succesfully using blitzjs monorepo without lerna, and just using yarn 1 workspace. Following this tutorial: https://dev.to/t7yang/typescript-yarn-workspace-monorepo-1pao
Typescript just work across local package - you can get typings from another local package.
Most helpful comment
I am succesfully using blitzjs monorepo without lerna, and just using yarn 1 workspace. Following this tutorial: https://dev.to/t7yang/typescript-yarn-workspace-monorepo-1pao
Typescript just work across local package - you can get typings from another local package.