question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@kitql/all-in does not work with pnpm

See original GitHub issue

Describe 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'; image

  • graphql-codegen not found. It seems like installing kitql/allin with pnpm does not really install the dependencies of kitql. image

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:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
nhe23commented, May 19, 2022

Thank you for taking a look and resolving this issue so quickly. I really appreciate kitql and the work your doing 👍

I’m not a day to day user of pnpm, so I don’t know why it’s like this by default.

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.

Maybe I should gain more knowledge about this package manager as it seems promising

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 😄 )

4/ I’m curious, why starting to replicate de demo1 and not cloning it / Stackblitz it?

Would have been easier but I wanted to have a repo that exactly followed the getting started guide.

2reactions
jycouetcommented, May 18, 2022

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 with node-linker=hoisted And then, when you do pnpm i, you will get deps of deps. => PERFECT 🥳 I’m not a day to day user of pnpm, 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 discover

3/ 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:

  • Clone locally (degit)
  • Using Stackblitz button to be able to use it directly in the browser… Where you can try and find out things

I think that the issue is solved, if you have any thing else, do not hesitate to re open 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found