I read the following article, and point #4 seems to pertain to me:
You manually manipulate your
node_modules
directory in some way during install - and that can corrupt the node module cache which we store and attempt to reuse. This is not generally regarded as a good practice and should be avoided for optimal results in our continuous deployment environment.
Our project is a monorepo built with Rush: https://rushjs.io/
As described in their documentation, they have the following feature:
A single NPM install: In one step, Rush installs all the dependencies for all your projects into a common folder. This is not just a “package.json” file at the root of your repo (which might set you up to accidentally
require()
a sibling’s dependencies). Instead, Rush uses symlinks to reconstruct an accurate “node_modules” folder for each project, without any of the limitations or glitches that seem to plague other approaches.
Furthermore, the root folder that contains all of the dependencies is not node_modules
in the project root, but it is /common/temp/node_modules
.
This appears to be causing problems with our builds. Our initial build succeeded, while subsequent builds failed. However, subsequent builds will succeed after clearing the cache.
Our build runs a command to build a Storybook application, and errors with Error: Cannot find module '/opt/build/repo/node_modules/@storybook/react/bin/build.js
, leading me to believe dependencies have not properly been installed (or reinstated from cache).
Are there any suggestions on how to fix this issue?
Netlify Instance
https://yolkai.netlify.com/
Did you use the search before posting?
Yes, read the linked article above and both linked articles within.
Also did a search of the forum for issues related to Rush.