Build errors appeared while following Shopify’s Node + React embedded app tutorial, especially after adding Shopify App Bridge in the Polaris UI step. Screenshots of the console/browser errors were central to the report.
Key troubleshooting steps discussed:
Checked dotenv, .env, and require('dotenv').config() early in the app.
Considered a Next.js-specific issue, then a possible Babel/React preset problem.
Reviewed _app.js, server.js, and next.config.js.
Noted an earlier workaround: removing deprecated next/css code from next.config.js.
A major point of debate was Node.js compatibility:
The sample app worked for another participant on Node v13.8.0.
The reported setup used Node v14.15.4, and the user suspected newer Node versions might trigger the issue.
Most recent outcome:
Deleting node_modules and reinstalling dependencies with npm install resolved the original build/startup problem.
The app now runs, but a new TypeError remains.
Status: partially resolved. The initial build issue appears fixed, but a separate runtime error is still open, and the user plans to restart from scratch to verify.
Thanks for your quick reply. I tried to run “npm install dotenv”, I have .env file with correct values in the root of the app folder and the first line of next.config.js is already “require(‘dotenv’).config()” but it didn’t work. Still getting the same errors.
Yeah, it looks like something related to next server. I also tried to run the completed project cloning from github and still same errors. Nothing changed. Here is the link of that completed code.
Ok looks like a problem with Babel loader and missing React preset. I think you can install the missing npm modules then configure them in next.config.js although I haven’t tried it out myself.
Sorry to make you provide so many details, I think you just need to check your node version. I’m using v13.8.0. Check by running node -v. If that doesn’t work revert back any changes you made and delete node_modules folder and run npm install again.
Now I had a chance to look at it again. My node version is v14.15.4. The previous error that I mentioned was related to the node version specifically node -v > v14.15.1. I haven’t tried to run it using node 13 but I guess if I did, it would work. I’ll try it and I’ll let you know the result but I believe there’s gotta be another way to run it with the latest node version.
That worked, the app is running now but I’m getting a TypeError. That must be something unrelated to this problem because it’s working. I’m gonna start from scratch and tell you how it goes.