Vue 2 projects suddenly fail building

Hello, been using Netlify for quite some time. And got several projects running here. So far i have been happy using it, but recently all of our projects fail during build. Based upon the build error message, it seem to be an npm package that been declared untrusty. (which is fine). Only issue is that it is affecting all projects, and they need to stay alive and not go down due to it.

The projects that fails are being written using Vue 2, so there are something here.
(Did test with a vue 3 project, which passed, so knowing it is something going around with vue2 and netlify that are not agreeing with each other heh).

Here are the Log given:

12:57:05 PM: Netlify Build
12:57:05 PM: ────────────────────────────────────────────────────────────────
12:57:05 PM: ​
12:57:05 PM: ❯ Version
12:57:05 PM: @netlify/build 29.11.7
12:57:05 PM: ​
12:57:05 PM: ❯ Flags
12:57:05 PM: baseRelDir: true
12:57:05 PM: buildId: 6479cae9382d9a1a4727ace9
12:57:05 PM: deployId: 6479cae9382d9a1a4727aceb
12:57:05 PM: ​
12:57:05 PM: ❯ Current directory
12:57:05 PM: /opt/build/repo
12:57:05 PM: ​
12:57:05 PM: ❯ Config file
12:57:05 PM: No config file was defined: using default values.
12:57:05 PM: ​
12:57:05 PM: ❯ Context
12:57:05 PM: production
12:57:05 PM: ​
12:57:05 PM: Build command from Netlify app
12:57:05 PM: ────────────────────────────────────────────────────────────────
12:57:05 PM: ​
12:57:05 PM: $ npm run build
12:57:06 PM: > path@0.1.0 build
12:57:06 PM: > vue-cli-service build
12:57:06 PM: - Building for production…
12:57:07 PM: node:internal/crypto/hash:71
12:57:07 PM: this[kHandle] = new _Hash(algorithm, xofLen);
12:57:07 PM: ^
12:57:07 PM: Error: error:0308010C:digital envelope routines::unsupported
12:57:07 PM: at new Hash (node:internal/crypto/hash:71:19)
12:57:07 PM: at Object.createHash (node:crypto:133:10)
12:57:07 PM: at module.exports (/opt/build/repo/node_modules/webpack/lib/util/createHash.js:135:53)
12:57:07 PM: at NormalModule._initBuildHash (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:417:16)
12:57:07 PM: at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:471:10)
12:57:07 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:503:5
12:57:07 PM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:358:12
12:57:07 PM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
12:57:07 PM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
12:57:07 PM: at Array. (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
12:57:07 PM: at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
12:57:07 PM: at /opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
12:57:07 PM: at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:123:16
12:57:07 PM: at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
12:57:07 PM: opensslErrorStack: [ β€˜error:03000086:digital envelope routines::initialization error’ ],
12:57:07 PM: library: β€˜digital envelope routines’,
12:57:07 PM: reason: β€˜unsupported’,
12:57:07 PM: code: β€˜ERR_OSSL_EVP_UNSUPPORTED’
12:57:07 PM: }
12:57:07 PM: Node.js v18.16.0
12:57:07 PM: ​
12:57:07 PM: β€œbuild.command” failed
12:57:07 PM: ────────────────────────────────────────────────────────────────
12:57:07 PM: ​
12:57:07 PM: Error message
12:57:07 PM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
12:57:07 PM: ​
12:57:07 PM: Error location
12:57:07 PM: In Build command from Netlify app:
12:57:07 PM: npm run build
12:57:07 PM: ​
12:57:08 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
12:57:07 PM: Resolved config
12:57:07 PM: build:
12:57:07 PM: command: npm run build
12:57:07 PM: commandOrigin: ui
12:57:07 PM: publish: /opt/build/repo/dist
12:57:07 PM: publishOrigin: ui
12:57:08 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:57:08 PM: Failing build: Failed to build site
12:57:09 PM: Finished processing build request in 26.213s

Update: Still not working, but here is what i have tried.
npm run build locally works good, no error displayed here.
Adding --openssl-legacy-provider to the build script.

  • Locally its fine still, build on netlify still fails.

I’d recommend to switch to Vite (and Vue 3), Vue 2 will soon be off the β€œmaintenance” shelves.

You can continue using Node 16 or if you want to use Node 18 (recommended), you should be setting

You mention you’ve set it, but I don’t see it being set. How have you set it?

Heya,
Working on changing into vue 3, but there is an overwhelming amount of live projects who needs to be remade ish, due to it. (vue 2 with vuetify, while running vue3 with tailwind).

Sorry did not push the latest build error, due to it looking exactly the same.
Posting it below :

8:05:19 AM: Netlify Build
8:05:19 AM: ────────────────────────────────────────────────────────────────
8:05:19 AM: ​
8:05:19 AM: ❯ Version
8:05:19 AM: @netlify/build 29.11.7
8:05:19 AM: ​
8:05:19 AM: ❯ Flags
8:05:19 AM: baseRelDir: true
8:05:19 AM: buildId: 647d7b0717162c0008fc1b5c
8:05:19 AM: deployId: 647d7b0717162c0008fc1b5e
8:05:19 AM: ​
8:05:19 AM: ❯ Current directory
8:05:19 AM: /opt/build/repo
8:05:19 AM: ​
8:05:19 AM: ❯ Config file
8:05:19 AM: No config file was defined: using default values.
8:05:19 AM: ​
8:05:19 AM: ❯ Context
8:05:19 AM: production
8:05:19 AM: ​
8:05:19 AM: Build command from Netlify app
8:05:19 AM: ────────────────────────────────────────────────────────────────
8:05:19 AM: ​
8:05:19 AM: $ npm run build
8:05:19 AM: > path@0.1.0 build
8:05:19 AM: > vue-cli-service build --openssl-legacy-provider
8:05:20 AM: - Building for production…
8:05:20 AM: node:internal/crypto/hash:71
8:05:20 AM: this[kHandle] = new _Hash(algorithm, xofLen);
8:05:20 AM: ^
8:05:20 AM: Error: error:0308010C:digital envelope routines::unsupported
8:05:20 AM: at new Hash (node:internal/crypto/hash:71:19)
8:05:20 AM: at Object.createHash (node:crypto:133:10)
8:05:20 AM: at module.exports (/opt/build/repo/node_modules/webpack/lib/util/createHash.js:135:53)
8:05:20 AM: at NormalModule._initBuildHash (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:417:16)
8:05:20 AM: at handleParseError (/opt/build/repo/node_modules/webpack/lib/NormalModule.js:471:10)
8:05:20 AM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:503:5
8:05:20 AM: at /opt/build/repo/node_modules/webpack/lib/NormalModule.js:358:12
8:05:20 AM: at /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
8:05:20 AM: at iterateNormalLoaders (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
8:05:20 AM: at Array. (/opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
8:05:20 AM: at Storage.finished (/opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
8:05:20 AM: at /opt/build/repo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
8:05:20 AM: at /opt/build/repo/node_modules/graceful-fs/graceful-fs.js:123:16
8:05:20 AM: at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
8:05:20 AM: opensslErrorStack: [ β€˜error:03000086:digital envelope routines::initialization error’ ],
8:05:20 AM: library: β€˜digital envelope routines’,
8:05:20 AM: reason: β€˜unsupported’,
8:05:20 AM: code: β€˜ERR_OSSL_EVP_UNSUPPORTED’
8:05:20 AM: }
8:05:20 AM: Node.js v18.16.0
8:05:20 AM: ​
8:05:20 AM: β€œbuild.command” failed
8:05:20 AM: ────────────────────────────────────────────────────────────────
8:05:20 AM: ​
8:05:20 AM: Error message
8:05:20 AM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
8:05:20 AM: ​
8:05:20 AM: Error location
8:05:20 AM: In Build command from Netlify app:
8:05:20 AM: npm run build
8:05:20 AM: ​
8:05:20 AM: Resolved config
8:05:22 AM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
8:05:20 AM: build:
8:05:20 AM: command: npm run build
8:05:20 AM: commandOrigin: ui
8:05:20 AM: publish: /opt/build/repo/dist
8:05:20 AM: publishOrigin: ui
8:05:22 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:05:22 AM: Failing build: Failed to build site
8:05:22 AM: Finished processing build request in 23.097s

Can you share your build settings and repo?

Mate, you can try put in the build script

vue-cli-service --openssl-legacy-provider build 

instead of

vue-cli-service build --openssl-legacy-provider
1 Like

Try setting an environment variable NODE_VERSION=16.20.2