May you help me with an error in Gatsby? When I use yarn workspaces to start the development of theme, I get an error while installing the Gatsby dependency on my workspace. Look this.
error C:\Users\Kirito\Desktop\ninja-react\node_modules\gatsby-cli: Command failed.
Exit code: 1
Command: node scripts/postinstall.js
Arguments:
Directory: C:\Users\Kirito\Desktop\ninja-react\node_modules\gatsby-cli
Output:
internal/modules/cjs/loader.js:311
throw err;
Error: Cannot find module 'project_folder\node_modules\chalk\source'.
My env: Node 14.15.0 - Yarn 1.22.11.
My package json in root:
{
"workspaces": [
"sites/theme-dev",
"packages/gatsby-theme-docs"
],
"private": true
}
I accomplished to install react and react-dom normally, but with Gatsby have a conflict.
{
"name": "theme-dev",
"version": "1.0.0",
"license": "MIT",
"main": "index.js",
"private": true,
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
}
}
According to this GitHub thread try:
node_modulesand reinstall all dependencies again.Remember to clean cache in each trial by running
gatsby cleancommand.Other interesting threads: