Error: [BABEL] /opt/build/repo/src/index.js: Cannot find module '@babel/helper-call-delegate'

I am currently seeing this error when building my branch. I am using create-react-app behind the scenes. I used to see the same issue on my local, but clearing the node_modules directory and running yarn again fixed it. Unfortunately I am unable to do the same on the netlify environment. I tried upgrading my package.json version but that did not work. Can someone please look into it? Thanks!

Error log:
11:45:54 PM: Error: [BABEL] /opt/build/repo/src/index.js: Cannot find module ‘@babel/helper-call-delegate’ (While processing: “/opt/build/repo/node_modules/babel-preset-react-app/index.js”)
11:45:54 PM: error Command failed with exit code 1.

App name:
outreach-sg

hi there, welcome!
can you post your package.json please?

Thanks for the quick reply. Here it is. Hope it helps.

{
“name”: “project-kaya”,
“version”: “0.2.2”,
“private”: true,
“dependencies”: {
@testing-library/jest-dom”: “^5.2.0”,
@testing-library/react”: “^10.0.1”,
@testing-library/user-event”: “^10.0.0”,
“dotenv-cli”: “^3.1.0”,
“firebase”: “^7.9.1”,
“ra-data-fakerest”: “^3.0.1”,
“ra-data-json-server”: “^3.2.0”,
“react”: “^16.12.0”,
“react-admin”: “^3.2.1”,
“react-dom”: “^16.12.0”,
“react-helmet”: “^5.2.1”,
“react-scripts”: “^3.4.1”,
“styled-components”: “^5.0.1”,
“styled-normalize”: “^8.0.7”,
“typeface-russo-one”: “^0.0.72”
},
“scripts”: {
“start”: “react-scripts start”,
“build”: “react-scripts build”,
“test”: “react-scripts test”,
“eject”: “react-scripts eject”
},
“eslintConfig”: {
“extends”: “react-app”
},
“browserslist”: {
“production”: [
“>0.2%”,
“not dead”,
“not op_mini all”
],
“development”: [
“last 1 chrome version”,
“last 1 firefox version”,
“last 1 safari version”
]
},
“devDependencies”: {}
}

I think clearing the cache for me would help. I did that on my local and I am able to run yarn build successfully. The same command does not work on Netlify servers. I also need this to run on the dev branch and not on the production branch (which is why I don’t have the option to clear cache in the Netlify UI).

Any way I can clear the cache for my branch ‘dev-app’ ? I think this will resolve the issue as it did on my ‘master’ (production) branch. Thanks.

UPDATE: Was able to get the issue fixed by switching from building with ‘yarn’ to building with ‘npm’

Thanks so much for the follow-up, @oliverox! I assume you use npm locally as well?

Yes I do. Locally it’s easy to just delete node_modules and reinstall. It would be great if we could easily clear cache on Netlify servers for branch deploys.

hi @oliverox, were you aware of this?

@perry: Yes I was aware of this but it wasn’t helpful AFAIK this feature to “clear cache and deploy site” is only available for the production build and not for branch builds (unless I am wrong here, so please correct me).

No confusion - you’re right, that is only available for the production branch.