Closed maneesha closed 1 year ago
I think this is a node issue. Netlify says it runs npm install
by default.
Maybe @zkamvar can help? (not super urgent but would ideally like to have this fixed before end of year)
I also think it's a node issue. Specifically, I think it has to do with the cache that Netlify has (but can not tell how the cache is setup):
For example, in this deploy that worked on November 30, things were built fine and it shows node working to build the dependencies and move everything into folders: https://app.netlify.com/sites/carpentries-org-preview/deploys/63877449d3e970000866bd15#L269-L291
However, recent deploys do not go through all those steps and instead looks for a cache and attempts to restore with no messages:
https://app.netlify.com/sites/carpentries-org-preview/deploys/6387cae43cff26000870e9d4#L139-L141
1:28:15 PM: No npm workspaces detected
1:28:15 PM: Started restoring cached node modules
1:28:15 PM: Finished restoring cached node modules
I am rerunning https://app.netlify.com/sites/carpentries-org-preview/deploys/639777eb8a4c33301fac0939 while resetting the cache and it looks to be running, so it is a cache issue. I get a feeling that the JS modules in here are not set up in a typical fashion (probably to facilitate offline development).
Also, FWIW, unless something changed, we deploy PR previews through Netlify and https://beta.carpentries.org/ through AWS. The builds from Netlify will go to https://carpentries-org-preview.netlify.app/.
I believe it has something to do with registration of the carpentries domain being tied to CloudFront and being unable to serve a subdomain from another service, but that's an area that I'm still unfamiliar with.
I know what's happening:
The cache restore for node modules does not consider the postinstall script in our package.json:
When it restore the cache, it's literally just moving the cached files over to node_modules/
.
Our solution likely is to run the postinstall script in _build_netlify.sh
This explains a bit of the logic behind the caching as well: https://github.com/netlify/build-image/issues/714#issuecomment-998514277
I suspect that the postinstall script that we have right now is a desire path that has not been paved in npm.
Note: the path I took to get here:
You can check which directories are cached by searching for $NETLIFY_CACHE_DIR in the run-build-functions.sh file for your site’s selected build image.
All Netlify build images are stored in a public GitHub repository. The repository README includes a list of available images and instructions for testing locally.
restore_node_modules()
and then follow the breadcrumbs from there.
Build checks on PRs keep failing. Here's an example explanation from the Netlify logs (private link). I don't know what this means or how to fix it.