-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Path Validation Error: Path(s) specified in the action for caching does not exist #1137
Comments
Hi @yashsway 👋, |
We're seeing this too for the first time today on yarn berry projects with |
Unexpectedly getting the same with a project with a yarn v1 lockfile and |
Hi Team,
This is my github action:-
Runner: Github Hosted We are installing the required dependencies too , and this issue started to occur few days back. |
Hello @yashsway The error "Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved" occurs because the caching action cannot find the specified paths. This typically happens when the necessary directories or files do not exist at the time the caching action is executed. Explanation and Steps to Resolve: Ensure Dependencies are Installed Before Caching: Updated workflow: env:
By ensuring that the dependencies are installed before the caching step, you can avoid the path validation error and successfully cache the pnpm dependencies. If you are experiencing the same issue with a project that uses a Yarn v1 lockfile and the I hope this helps! Please let us know if you have any further concerns or questions. |
Sorry @mahalakshmi-rekadi but it doesn't make any sense to me. What is the purpose of cache then? If we need to install the packages before activating cache, well, then cache is useless. |
Hello @javiertury , |
@mahalakshmi-rekadi, some issues are still not clear to me.
Suppose that I run your proposed workflow (first install, then setup node with cache for pnpm). Does it mean that next time I run that workflow, the install step will read from cache? Or does it imply that I have to manually edit the action and move the installation step to the end in order to read from the cache? The last case would be very inconvenient, specially if the cache is purged or expired and I have to setup everything manually again every so often.
|
Can anyone suggest on this, in our case we are even installing the dependencies, and the failure is only for few of them and not all. |
Hello @yashsway, Please let us know if the above resolved with the above work around or still have further concerns. |
I tried the solution proposed by @aparnajyothi-y but it didn't work, I get the same errors. For the sake of clarity, this was my workflow env:
PNPM_CACHE_FOLDER: .cache/pnpm
jobs:
publish_container:
runs-on: ubuntu-latest
steps:
-
name: Check out repository code
uses: https://github.com/actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Verify PNPM Cache Directory
run: |
if [ ! -d "$PNPM_CACHE_FOLDER/store/v3" ]; then
echo "PNPM cache directory does not exist, creating it."
mkdir -p "$PNPM_CACHE_FOLDER/store/v3"
else
echo "PNPM cache directory exists."
fi
- name: Setup package manager cache
uses: actions/setup-node@v4
with:
cache: 'pnpm'
- name: Setup pnpm config
run: pnpm config set store-dir $PNPM_CACHE_FOLDER
- name: Install and build project
run: |
pnpm install --frozen-lockfile
pnpm run build
...
|
Hello @javiertury, Thank you for your response. We ran the same workflow, and everything is working fine on our end. Please find the screenshots attached for your reference. It would be helpful if you could share the reproduction link, as we are unable to replicate the error using the provided workaround. |
@aparnajyothi-y the workflow from your screenshot is not the same I posted, in fact it's quite different. However when I saw those After many hours of debugging I managed to solve the issue env:
RUNNER_TOOL_CACHE: /toolcache
PNPM_CACHE_FOLDER: .cache/pnpm
jobs:
test:
runs-on: ubuntu-latest
steps:
-
name: Check out repository code
uses: https://github.com/actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
# Optional, the default pnpm store is .pnpm-store if the step below is omitted
- name: Setup pnpm config
run: pnpm config set store-dir "$PNPM_CACHE_FOLDER"
# Makes sure the pnpm store path exists (which is exactly what setup-node cares about)
- name: Verify PNPM Cache Directory
run: |
PNPM_STORE_PATH="$( pnpm store path --silent )"
if [ ! -d "$PNPM_STORE_PATH" ]; then
echo "PNPM store directory does not exist, creating it."
mkdir -p "$PNPM_STORE_PATH"
else
echo "PNPM store directory exists."
fi
- name: Setup package manager cache
uses: actions/setup-node@v4
with:
cache: 'pnpm'
- name: Build
run: |
pnpm install --frozen-lockfile && pnpm run build The order of the steps above is very important. All that |
Hello @javiertury, Thank you for sharing your workflow and insights. It seems that your solution is quite similar to the one we suggested earlier. The root cause of the error was the missing PNPM cache directory (PNPM_CACHE_FOLDER), which led to the Path Validation Error: Path(s) specified in the action for caching does not exist. In our workflow, we ensured that the PNPM cache directory was created before attempting to cache using setup-node, which resolved the issue. Here's a summary of the changes we made as a workaround: Verification of Cache Directory:
By ensuring the cache directory exists before caching, we were able to resolve the error. It looks like this solution addresses the issue you're facing as well, with the directory path validation in place. If you run into any further issues or need more assistance, please feel free to reach out. |
@aparnajyothi-y I appreciate your effort and it was indeed a diagnostic and a good hint, but your workflow snippet/step was far from a full solution to my problem, as well as in a general sense. Since you never post a complete workflow, it is hard to know in which position to place your snippet and it doesn't work with previous workflows posted on this thread. Given the lack of context, it is natural to fallback to a previous general workflow like the original one postted by @yashsway or the one by @mahalakshmi-rekadi. In any of these cases the path that you propose, I think overall you did a good job and your posts would become even more helpful by
|
Hello @javiertury, Thank you for your detailed feedback—I really appreciate it. |
Description:
Getting a strange error in the "Post setup node.js" step in my GitHub workflow. I ran the workflow with debugging enabled and this step fails with this error:
Action version:
v3 as
uses: actions/setup-node@v3
Platform:
ubuntu-latest
)Runner type:
Tools version:
pnpm
("packageManager": "[email protected]"
inpackage.json
at the root of my monorepo)Repro steps:
This is my GitHub action.
Expected behavior:
Not really sure what is actually supposed to happen here.
Actual behavior:
With debugging enabled, this is the full trace for the step:
0s
##[debug]Evaluating condition for step: 'Post setup node.js'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Post setup node.js
##[debug]Loading inputs
##[debug]Evaluating: (((github.server_url == 'https://github.com') && github.token) || '')
##[debug]Evaluating Or:
##[debug]..Evaluating And:
##[debug]....Evaluating Equal:
##[debug]......Evaluating Index:
##[debug]........Evaluating github:
##[debug]........=> Object
##[debug]........Evaluating String:
##[debug]........=> 'server_url'
##[debug]......=> 'https://github.com'
##[debug]......Evaluating String:
##[debug]......=> 'https://github.com'
##[debug]....=> true
##[debug]....Evaluating Index:
##[debug]......Evaluating github:
##[debug]......=> Object
##[debug]......Evaluating String:
##[debug]......=> 'token'
##[debug]....=> ''
##[debug]..=> ''
##[debug]=> ''
##[debug]Expanded: ((('https://github.com' == 'https://github.com') && '') || '')
##[debug]Result: '***'
##[debug]Loading env
Post job cleanup.
##[debug]Checking zstd --quiet --version
##[debug]1.5.6
##[debug]zstd version: 1.5.6
##[debug]implicitDescendants 'false'
##[debug]followSymbolicLinks 'true'
##[debug]implicitDescendants 'false'
##[debug]omitBrokenSymbolicLinks 'true'
##[debug]Search path '/home/runner/setup-pnpm/node_modules/.bin/store/v3'
##[debug]Cache Paths:
##[debug][]
Error: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Post setup node.js
The text was updated successfully, but these errors were encountered: