-
Notifications
You must be signed in to change notification settings - Fork 438
Local cache of node_modules doesn't work with yarn workspaces #8
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
Comments
Also getting this error.
|
Any update on this? |
I'm also encountering issues when node_modules is retrieved from cache. For me it's happening with S3 cache.
|
Hi, any update on this? |
@josephvusich this issue does not appear to have been resolved, would you be able to have a look into it? |
I've seen an approach, by setting a cache directory here: https://mechanicalrock.github.io/2019/02/03/monorepos-aws-codebuild.html |
This seems like another approach, specifying the entire directory should work. https://stackoverflow.com/questions/58793704/aws-codebuild-local-cache-failing-to-actually-cache I've not tried it yet. |
Unfortunately this doesn't work for me. |
I have this same issue. I am using |
So is there a solution to this? |
The best solution I can think of for now is to copy all of the cache paths (e.g. |
I was having the exact same issue (" Before:
After:
If you already have your project configured you can edit the cache accessing the Project -> Edit -> Artifacts -> Additional configuration. My buildspec.yml is as follows: version: 0.2
phases:
install:
runtime-versions:
nodejs: 14
build:
commands:
- yarn config set cache-folder /root/.yarn-cache
- yarn install --frozen-lockfile
- ...other build commands go here
cache:
paths:
- '/root/.yarn-cache/**/*'
- 'node_modules/**/*'
# This third entry is only if you're using monorepos (under the packages folder)
# - 'packages/**/node_modules/**/*' If you use NPM you'd do something similar, with slightly different commands: version: 0.2
phases:
install:
runtime-versions:
nodejs: 14
build:
commands:
- npm config -g set prefer-offline true
- npm config -g set cache /root/.npm
- npm ci
- ...other build commands go here
cache:
paths:
- '/root/.npm-cache/**/*'
- 'node_modules/**/*'
# This third entry is only if you're using monorepos (under the packages folder)
# - 'packages/**/node_modules/**/*' Kudos to: https://mechanicalrock.github.io/2019/02/03/monorepos-aws-codebuild.html |
GIVEN :
Buildspec execute this script on CI : [[ -f /tmp/cached-dir/cached-file ]] || echo 'FILE NOT CACHED YET'
touch /tmp/cached-dir/cached-file # create the file in the cache (should not print line above next build) THEN on Aws CI: Run 2 build in a row and got : 2021/09/12 08:34:48 Moving to directory /codebuild/output/src530968031/src
2021/09/12 08:34:48 Symlinking: /tmp/cached-dir /codebuild/local-cache/custom/5ed44f40b68ea51c687c07d4dfdc9f4c800e493dbad13bc37339f9d742085300/tmp/cached-dir
FILE NOT CACHED YET Conclusion : Local cache does not work or the setup is kept secret so we use S3 bucket and pay. :) |
See https://stackoverflow.com/questions/55890275/aws-codebuild-does-not-work-with-yarn-workspaces for a description of the problem.
The text was updated successfully, but these errors were encountered: