Error: Command "npm run build" exited with 1

Hello all,

I’m having problem redeploying my frontity project to vercel. I used to deploy succefully. Ever since I upgraded node to 18 I couldn’t run the app.

I downgraded node to v.16.18.1 and was able to run frontity locally. But I still can’t deploy to vercel.

The error is the following:
Error: error:0308010C:digital envelope routines::unsupported
09:45:21.927 at new Hash (node:internal/crypto/hash:71:19)
09:45:21.927 at Object.createHash (node:crypto:133:10)
09:45:21.928 at module.exports (/vercel/path0/node_modules/webpack/lib/util/createHash.js:135:53)
09:45:21.928 at NormalModule._initBuildHash (/vercel/path0/node_modules/webpack/lib/NormalModule.js:417:16)
09:45:21.928 at handleParseError (/vercel/path0/node_modules/webpack/lib/NormalModule.js:471:10)
09:45:21.928 at /vercel/path0/node_modules/webpack/lib/NormalModule.js:503:5
09:45:21.928 at /vercel/path0/node_modules/webpack/lib/NormalModule.js:358:12
09:45:21.928 at /vercel/path0/node_modules/loader-runner/lib/LoaderRunner.js:373:3
09:45:21.929 at iterateNormalLoaders (/vercel/path0/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
09:45:21.929 at iterateNormalLoaders (/vercel/path0/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
09:45:21.929 at /vercel/path0/node_modules/loader-runner/lib/LoaderRunner.js:236:3
09:45:21.929 at context.callback (/vercel/path0/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
09:45:21.930 at /vercel/path0/node_modules/babel-loader/lib/index.js:59:71
09:45:21.961 Error: Command “npm run build” exited with 1.

I also have npm 8.19.2 installed.

Any ideas?

Thanks in advance!

Same here…

OKey guys, I have an update for this. I did a lot of investigation and looking at resources and PRs from the vercel team.
So because there is now node 18.x you actually need to specify the node version in the engines in your package.json, like this:

  "engines": {
    "node": "16.x"

At first I thought its a bug as based on my testing, when using a custom builder the engines property was ignored. I talked to some engineers at vercel and they said that its not a bug, it simply didnt affect out build before, because 16.x was the latest available version or something like this.
I will also share this same message here: WARNING: All your builds using @frontity/now will break as of August 9th 2022 - #18 by anantajitjg as this is where we were tracking a similar issue.

Thank you for the quick response. For me it still gives the same issue.
I tried all the node I have, and no change. here:

You need to do it exactly like in the code i pasted. It wont work with anything higher than version 16. So just replace the engines part you have with this:

  "engines": {
    "node": "16.x"

Well, I hate to bug you again but I did everything in my power but still get this error. (Back on friday this code had no useState probem)

Had the same issue before, and spent some time debugging it. Fix is quite easy:

  1. Remove node_modules folder from project root
  2. Delete package-lock.json
  3. Run npm i
  4. Profit

Did it, still gives the same error back. I also tried from other PC-s, older and newer commits as well. Nothing seems to work, I am really under the weather because of this issue. :frowning:

I everyone I have the same issue if someone have the solution :slight_smile:

Can you guys try to make a sandbox with from your repo to see if it still behaves like this? Then we know if its an issue with your own env or if its from something else.
I am quite busy those days but I will try to help u as much as possible.