Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for pnpm #88

Closed
Farro178 opened this issue Dec 7, 2022 · 3 comments
Closed

Add support for pnpm #88

Farro178 opened this issue Dec 7, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@Farro178
Copy link

Farro178 commented Dec 7, 2022

We're using pnpm with workspaces and were looking to use this package, unfortunately thats not an option as we don't believe pnpm is yet supported as it's not looking for a pnpm-lock file. Similarly we noticed that support for yarn hasn't been added yet but that is an open PR for it currently.

/Users/jamesfarrelly/Library/pnpm/store/v3/tmp/dlx-49232/node_modules/.pnpm/[email protected]/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error: phero-client exited with code: 1 null
    at ChildProcess.<anonymous> (/Users/jamesfarrelly/Library/pnpm/store/v3/tmp/dlx-49232/node_modules/.pnpm/[email protected]/node_modules/phero/dist/process.js:25:15)
    at ChildProcess.emit (node:events:513:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
 ERROR  Command failed with exit code 7: /Users/jamesfarrelly/Library/pnpm/store/v3/tmp/dlx-49232/node_modules/.bin/phero

pnpm: Command failed with exit code 7: /Users/jamesfarrelly/Library/pnpm/store/v3/tmp/dlx-49232/node_modules/.bin/phero
    at makeError (/usr/local/Cellar/pnpm/7.18.0/libexec/dist/pnpm.cjs:22852:17)
    at handlePromise (/usr/local/Cellar/pnpm/7.18.0/libexec/dist/pnpm.cjs:23423:33)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.handler [as dlx] (/usr/local/Cellar/pnpm/7.18.0/libexec/dist/pnpm.cjs:202440:7)
    at async /usr/local/Cellar/pnpm/7.18.0/libexec/dist/pnpm.cjs:209882:21
    at async main (/usr/local/Cellar/pnpm/7.18.0/libexec/dist/pnpm.cjs:209853:34)
    at async runPnpm (/usr/local/Cellar/pnpm/7.18.0/libexec/dist/pnpm.cjs:210079:5)
    at async /usr/local/Cellar/pnpm/7.18.0/libexec/dist/pnpm.cjs:210071:7

Keep up the great work anyway, this looks really promising!

@jim-lub
Copy link
Contributor

jim-lub commented Dec 7, 2022

Hey Farro,

The PR that makes sure to look for a yarn lock file is specifically aimed at making an export of your server. It's been open for a while, but I'll make sure to add the pnpm lock aswell before we merge it. We don't need the lock-file to set up your server and client in a development environment though.

Your issue seems to be related to a issue caused by a default workspaces setup. You're in luck because I've been setting up a workspaces + yarn setup recently in one of my personal projects. The way Phero currently looks for your server and client projects is quite specific: it searches for an installation in node_modules at the same level as the package.json file of the individual projects. This does not work in a workspaces setup, because they hoist all your packages to the top-level node_modules folder. Which results in Phero no longer knowing what to do.

The solution is to configure your workspaces (+pnpm in your case) to no longer hoist the phero packages, but keep them in the separate node_modules of the project folders. I've managed to find the following documentation about hoisting with pnpm (https://pnpm.io/npmrc#hoist-pattern):

  • If you're using a pnpm version higher than v7.12.0 you can exclude the phero package. (easiest)
  • If the version is lower you need to manually include each package, except the phero packages

We'd love to support workspaces (or any other monorepo setup) out of the box someday, but as of now we're doing a refactor of the way we generate the parsers to make it more accessible and extensible. So these kind of implementations have to wait a bit until we've completed that.

Hope this information helps you out. If you have any more questions, please reach out. You can find us on discord aswell (https://discord.com/invite/t97n6wQfkh).

@JasperH8g
Copy link
Contributor

@Farro178 this is fixed in #86! It's released as an alpha, we'll test it a bit more and release it for real. I'll go ahead and close this for now, but feel free to open a new issue if you got any problems ✌️

@JasperH8g
Copy link
Contributor

JasperH8g commented Feb 6, 2023

@Farro178 this is fixed in 0.9.14 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants