thanks for sharing your solution, @robinleboe! I bet you are not the only one!
I just ran into this issue again and for what it’s worth, the reason I got the 127 error this time is because I didn’t properly specify the Base directory and Publish directory in my Netlify deploy settings.
I ran into this same problem. After reading this (and several other docs provided by the great problem solvers in this thread), I will share my solution here for any future React / MERN developers who run into this deployment issue.
I used the following steps to achieve resolution:
- delete the current
node_modulesfiles/folders from working directory.
yarn installto create a fresh
node_modules(I am using the
yarntools, if you use
npmyou can substitute accordingly).
- double check that my repository uses
yarn buildin the Netlify build options (it is worth checking your scripts in
package.jsonas well if you also use custom scripts –
npmusers will probably build with
npm run-script buildor something along those lines).
git pushand watch deployment log as Netlify’s awesome CI kicks in.
Make sure you don’t get confused with your build commands/scripts and doing a fresh install of your packages never hurts! You can always make a backup before hand or use
git version control to restore back anything lost too.
thanks so much for sharing this straightforward writeup, @jaylowe1!
Great, that worked for me – thanks!
would you be able to check the deployment error message of my site oppenberger.netlify.app.
Deployment fails with this error code
4:48:39 PM: Error running command: Build script returned non-zero exit code: 1
4:48:39 PM: Failing build: Failed to build site
4:48:39 PM: failed during stage ‘building site’: Build script returned non-zero exit code: 1
4:48:39 PM: Finished processing build request in 3m1.393768483s
but also show a massive code block that doesn’t tell me anything. I am not sure what breaks the deployment and what to look for.
can you post or link us to a failed deploy log please - i do have the power to be able to read it
the log is to long to post it in here so i hope this link works for you https://app.netlify.com/sites/oppenberger/deploys/5eb07ef09a9beb0174654cd2
so i got a little ahead of myself - is your app building correctly on local?
I did check the log, and I am 98% sure that the giant code block you are seeing is somehow related to jQuery. I am wondering if somehow you are maybe linking to or incorporating jquery in your app in way that isn’t quite by the book. I realize the logging isn’t as useful as it could be.
Which ssg are you using to build this?
so, my local build works just fine and I am not using any jquery code in this project. However, I did add an extra package called “react-jvectormap”: “0.0.16” which I believe is full jquery code maybe it’s the troublemaker.
I am using Gatsby as my ssg
ok cool, i would suggest removing the possibly problematic dependency from your package.json and see if you can get a working deploy without it, just so we can narrow it down to that package. if you figure it out please let us know.
If it works on local but not on our system, there are three main culprits:
a.) case sensitivity
b.) some minor version inconsistency. Next question here is - did you commit your package lock file taken from your local machine? I would recommend that you do (try clear cache and redeploy for a fresh install). For more details on why this can cause problems, check my writeup in this similar thread:
c.) something is being ignored on remote because you have a gitignore (this is kinda rare)
hi perry, I removed the react-jvectormap package and also the dompurify package (this one caused an additional error) and it deployed without error message. thank you for help.
glad its working now. We have heard all kinds of difficulty from people using dompurify. If you run a search here in the forums you’ll see what i mean
I am trying to use react-jvectormap (0.0.16) with Gatsby and deploy it on Netlify. But I’m getting build errors. Removing the package imports from code results in a successful build. The package works well on the local server though. Here are the logs,
Were you able to resolve the build error while keeping react-jvectormap? If so, can you please share what worked for you?
I have checked and can confirm there is no case-sensitivity issue in the code/imports. I also deleted the node_modules folder, reinstalled packages and pushed package.json and package-lock.json files. Also, clearing cache and redeploying didn’t work either.
Any help would be appreciated.
P.S. I’m not using dompurify
HI, unfortunately I did not solve the issue as of now and got busy with other things. Sorry for being no help here.
hi @mujeebahmed10p - Sorry you are encountering this! I am not exactly sure what to suggest that I haven’t already except to reach out to the folks who made the package and see if they have any ideas as to what could be causing the problem. If they give you any useful info please do let us know. I wish I had more ideas - but i’m stumped.
Thank you for the follow-up to share what you discovered, @mujeebahmed10p. Closing the loop to share what you learned will hopeful provide benefit to someone else searching the community site for answers in the future.
We appreciate that you took the time to share your experience. It is amazingly helpful and not everyone loops back here when they find a solution!
Thanks for helping out guys! I really appreciate it.
Got a tip from someone to run,
(on local machine) and lo and behold I got a different error,
WebpackError: TypeError: Cannot set property 'vectorMap' of undefined
The issue is definitely not related to Netlify. It’s just that Gatsby isn’t able to use that package in it’s build process (probably need to add something to gatsby-config.js before it will start working).
Thanks bro…i got my problem solved
I struggled for 3 hours until I found your solution.