Closed thathurtabit closed 9 months ago
Assuming you have something like this in the step:
- name: Install pnpm
uses: pnpm/action-setup@v2
You need to provide a pnpm
version. According to the docs:
Version of pnpm to install.
Optional when there is a packageManager field in the package.json.
otherwise, this field is required It supports npm versioning scheme, it could be an exact version (such as6.24.1
), or a version range (such as6
,6.x.x
,6.24.x
,^6.24.1
,*
, etc.), orlatest
.
So either specify a version or a package_json_file
:
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: ^8.14.1
package_json_file: path/to/package.json # Alternatively, specify path to `package.json` that has `packageManager` field.
The packageManager
alternative is buggy due to non-standard convention followed by pnpm
. See more here.
This will fix your error if it's due to the version. If not, I cannot help without additional information or reproduction.
Hi, thanks for the reply, sorry I should have given more info:
So my github-action (called preview.yaml
) has:
steps:
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: ^8.14.1
My package.json
has:
"packageManager": "pnpm@8.14.1",
I get slightly different error messages between running the actions locally with act and when deployed to github
glssry.org
part of the path):act (local)
[Vercel Production Deployment/Deploy-Production] ⭐ Run Main pnpm/action-setup@v2.4.0
[Vercel Production Deployment/Deploy-Production] 🐳 docker cp src=/Users/Stephen.Fairbanks/.cache/act/pnpm-action-setup@v2.4.0/ dst=/var/run/act/actions/pnpm-action-setup@v2.4.0/
[Vercel Production Deployment/Deploy-Production] 🐳 docker exec cmd=[node /var/run/act/actions/pnpm-action-setup@v2.4.0/dist/index.js] user= workdir=
[Vercel Production Deployment/Deploy-Production] ❓ ::group::Running self-installer...
| [Error: ENOENT: no such file or directory, open '/Users/Stephen.Fairbanks/Repos/glssry.org/package.json'] {
| errno: -2,
| code: 'ENOENT',
| syscall: 'open',
| path: '/Users/Stephen.Fairbanks/Repos/glssry.org/package.json'
| }
[Vercel Production Deployment/Deploy-Production] ❗ ::error::Error: ENOENT: no such file or directory, open '/Users/Stephen.Fairbanks/Repos/glssry.org/package.json'
[Vercel Production Deployment/Deploy-Production] ❌ Failure - Main pnpm/action-setup@v2.4.0
[Vercel Production Deployment/Deploy-Production] exitcode '1': failure
Github:
Run pnpm/action-setup@v2.4.0
Running self-installer...
[Error: ENOENT: no such file or directory, open '/home/runner/work/glssry.org/glssry.org/package.json'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/home/runner/work/glssry.org/glssry.org/package.json'
}
Error: Error: ENOENT: no such file or directory, open '/home/runner/work/glssry.org/glssry.org/package.json'
I'd guess it's something simple I'm missing.
My best bet is sticking to one pnpm
version, either defined in package.json
or within the workflow file.
I'm not aware of your directory structure, but the action also expects a package_json_file
filepath incase you are running a monorepo setup for example.
My personal experience was that I faced errors defining the version in packageManager
field in package.json
due to the non-standard convention this action expects, so I stuck with defining it in the workflow file. And it worked without problems.
Regarding the double directory issue, I did get that as well in error logs. I am not sure if this is something for maintainers of this repo to fix, but here's another issue that might help you.
Hope this helps!
Thanks for your reply here, but I don't know if I can find a way to solve this.
Just for clarity on my folder structure (I'm running a Next app, but not a monorepo):
.github
- workflows
-- preview.yaml
-- production.yaml
...
package.json
Running act
locally to test the actions, I get the error:
Run Main pnpm/action-setup@v2.4.0
[Vercel Production Deployment/Deploy-Production] 🐳 docker cp src=/Users/Stephen.Fairbanks/.cache/act/pnpm-action-setup@v2.4.0/ dst=/var/run/act/actions/pnpm-action-setup@v2.4.0/
[Vercel Production Deployment/Deploy-Production] 🐳 docker exec cmd=[node /var/run/act/actions/pnpm-action-setup@v2.4.0/dist/index.js] user= workdir=
[Vercel Production Deployment/Deploy-Production] ❓ ::group::Running self-installer...
| [Error: ENOENT: no such file or directory, open '/Users/Stephen.Fairbanks/Repos/glssry.org/package.json'] {
| errno: -2,
| code: 'ENOENT',
| syscall: 'open',
| path: '/Users/Stephen.Fairbanks/Repos/glssry.org/package.json'
| }
...
ERR_PNPM_NO_PKG_MANIFEST No package.json found in /Users/Stephen.Fairbanks/Repos/glssry.org
If I click the path
in my terminal, it takes me directly to the package.json
file, so I don't know why the runner can't find it.
The issue you kindly provided doesn't seem to have a resolution unfortunately. I might just have to give up and go back to npm
.
Are you missing the uses: actions/checkout@v4
step in front of it?
This would result in you not having the package.json.
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v3
This was it @arcs- ! Thank you for taking a look. I clearly need to understand how github actions work. Thanks very much.
Admittedly my knowledge of
github-actions
andpnpm
is not great, and I'm running into this issue during thepnpm/action-setup
stage.For some reason - likely down to missing settings - it's doubling the app name, i.e.
glssry.org/glssry.org/package.json
I'm not sure why that is.