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

Pnpm: command not found #606

Closed
czernika opened this issue Aug 16, 2023 · 5 comments
Closed

Pnpm: command not found #606

czernika opened this issue Aug 16, 2023 · 5 comments

Comments

@czernika
Copy link

Sail Version

1.23.3

Laravel Version

10.19.0

PHP Version

8.2

Operating System

Linux

OS Version

Fedora 38 / Ubuntu 22.04

Description

Release 1.23.3 adds support for pnpm but I cannot "confirm" it

On a fresh Laravel + Sail installation

sail shell

pnpm --version

I receive error command not found. which pnpm prints nothing for me. I've installed new project, renamed image, run sail build --no-cache - same result. Repeated on remote Ubuntu server - nothing

If I change this line from curl -fsSL https://get.pnpm.io/install.sh | bash - into npm install -g pnpm (this is allowed installation method plus at this point npm is already installed) I finally can get response on which pnpm (prints /usr/bin/pnpm)

Maybe I'm doing something wrong on how to use it via shell. However all other services responds on which ... command so I'm expecting same result for pnpm

P.S. It is also good to proxy pnpm command into sail pnpm ...

Steps To Reproduce

  1. Install Laravel with Sail 1.23.3
  2. sail up -d
  3. sail shell
  4. which pnpm (or any pnpm command)
@driesvints
Copy link
Member

Ping @SamuelMTeixeira

@czernika
Copy link
Author

Was able to find it under this path /usr/lib/node_modules/corepack/shims/pnpm

изображение

I believe it because this path is not present in PATH variable. When installed via npm it puts executable under /usr/bin/

@SamuelMTeixeira
Copy link
Contributor

The error is happening because you haven't configured the command's alias. If you use dev container (which I usually use) or docker exec, it will work normally.

I'll make the change in /bin/sail to make sail pnpm work.

In order for sail to work, you'll also need to set the environment variable, or you could change the manual installation to npm i -g pnpm.

@czernika
Copy link
Author

@SamuelMTeixeira No I'm not using devcontainer. I tried it now and still getting same error. Even using docker exec I get

untitled

However even if I messed things up (which I am master at) and devcontainer works it kinda forces me to use it or do extra things. I would prefer

  1. Install
  2. Enjoy

rather than

  1. Install
  2. Do something
  3. Enjoy

so my thought is to change pnpm installation via npm since it "works out of the box". I see no extra problem in it as npm already installed at this point. And this way sail pnpm ... proxy will be I guess just a copy-paste for npm's else-if block with a little changes (screen from another project where I've changed installation method)

untitled

@driesvints
Copy link
Member

A PR was provided so let's continue the discussion there. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants