I'm trying to add a create-react-app
app inside a Turborepo monorepo.
Problem is that if I run npm install
from the root of the monorepo and then try to start the CRA app by running npm run dev
, I get the following error during compile time:
Loading PostCSS "postcss-preset-env" plugin failed: Cannot find module 'postcss-preset-env'
I noticed that if I run npm install
from within the CRA app folder (/apps/my-app
), and then run npm run dev
from the root of the monorepo, it runs just fine.
I also noted that depending from where I run npm install
, the contents of /apps/my-app/node_modules
will be different, but I think is the expected behaviour.
If I understand correctly the npm workspaces docs, you should always run npm install
from the root of the monorepo.
Any idea on what I'm missing here?
I'm using npm 8.3.1.
Here is a public repo with an example: https://github.com/oncet/turborepo-cra