@kitql/all-in does not work with pnpm
See original GitHub issueDescribe the problem
When I follow the Get started guide with pnpm I’m facing several issues.
-
@kitql/vite-plugin-watch-and-run.js is not found -> I solved this by adding it manually to my package.json and changing the import to
import watchAndRun from '@kitql/vite-plugin-watch-and-run';
-
graphql-codegen not found. It seems like installing kitql/allin with pnpm does not really install the dependencies of kitql.
Reproduction repo
I created a minimal reproduction repo here: https://github.com/nhe23/kitql-pnpm-bug
System info
System:
OS: macOS 12.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 93.14 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 17.9.0 - ~/.volta/tools/image/node/17.9.0/bin/node
Yarn: 1.22.18 - ~/.volta/tools/image/yarn/1.22.18/bin/yarn
npm: 8.5.5 - ~/.volta/tools/image/node/17.9.0/bin/npm
Browsers:
Brave Browser: 101.1.38.111
Chrome: 101.0.4951.64
Firefox: 100.0
Safari: 15.4
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
g pnpm` does not work · Issue #2481 - GitHub
Am using nvm-windows to manage node versions. Update: pnpm does not update any package. pnpm i -g any-package no longer updates the package....
Read more >pnpm install
If true , pnpm will use only packages already available in the store. If a package won't be found locally, the installation will...
Read more >Frequently Asked Questions - PNPM
pnpm does not work with <YOUR-PROJECT-HERE>?. In most cases it means that one of the dependencies require packages not declared in package.json ....
Read more >Installation | pnpm
You may install pnpm even if you don't have Node.js installed, using the following scripts ... To upgrade it, check what is the...
Read more >.npmrc | pnpm
With this layout, most of the packages in the ecosystem work with no issues. However, if some tooling only works when the hoisted...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for taking a look and resolving this issue so quickly. I really appreciate kitql and the work your doing 👍
Actually pnpm installs the graphql-codegen package (in its global directory) but does not add a symlink in the projects node_modules as it does this only for the packages that are in the package.json. This way your node_modules are not polluted by the dependencies of your dependencies of your dependencies (and so on 😄) which I like as a default behaviour. Thats why the pattern of @kitql/all-in does not work by default with pnpm. For me the best solution was to just add the dependencies directly to my package json.
I can only recommend it as it saves me so much time working with many projects that have similar dependencies. It also works great for monorepos and changeset management (End of ad 😄 )
Would have been easier but I wanted to have a repo that exactly followed the getting started guide.
Hey there, I had a look and here are my few points 🧑💻
1/ @kitql/vite-plugin-watch-and-run.js is not found
It was a typo in the doc of KitQL that is now fixed: https://www.kitql.dev/docs/all-in you have to import like this:
import watchAndRun from '@kitql/vite-plugin-watch-and-run'
2/ graphql-codegen not found
By default
pnpm
doesn’t install deps your deps. (so it’s not installing deps of@kitql/all-in
) To go around this, you can add a file.npmrc
withnode-linker=hoisted
And then, when you dopnpm i
, you will get deps of deps. => PERFECT 🥳 I’m not a day to day user ofpnpm
, so I don’t know why it’s like this by default… Maybe I should gain more knowledge about this package manager as it seems promising, but today I don’t see it! Apparently you can also manage this by pattern… scripting… https://pnpm.io/pnpmfile. I let you discover3/ reproduction ✅
Thx a lot for the reproduction, it’s easy to guide people when you spent the time to provide this. I did a PR to it to show all steps to fix the beginning: https://github.com/nhe23/kitql-pnpm-bug/pull/1 🥳
4/ I’m curious, why starting to replicate de demo1 and not cloning it / Stackblitz it?
Yes, in https://www.kitql.dev/docs/demos/01_demo-01, I show two ways to get the code:
degit
)Stackblitz
button to be able to use it directly in the browser… Where you can try and find out thingsI think that the issue is solved, if you have any thing else, do not hesitate to re open 👍