NodeJS 错误:错误:0308010C:数字信封例程::不支持

utugiqy6  于 2022-12-18  发布在  Node.js
关注(0)|答案(1)|浏览(216)

我一直在尝试部署我的nuxt应用程序到Vercel几天了,但我得到这个错误说:Error: error:0308010C:digital envelope routines::unsupported
我解决了我的本地机器降级我的node.js到16+的问题,但这仍然发生在生产环境中.我试图设置--openssl-legacy-provider到我的package.json中的scripts对象,但它没有效果. ps.我不太确定语法是否正确,因为大多数答案是react.
以下是整个错误:

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/vercel/path0/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/vercel/path0/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/vercel/path0/node_modules/webpack/lib/NormalModule.js:471:10)
    at /vercel/path0/node_modules/webpack/lib/NormalModule.js:503:5
    at /vercel/path0/node_modules/webpack/lib/NormalModule.js:358:12
    at /vercel/path0/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/vercel/path0/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/vercel/path0/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/vercel/path0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /vercel/path0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /vercel/path0/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.12.1
Error: Command failed with exit code 1: npx nuxt build --standalone --no-lock --config-file "nuxt.config.js" /vercel/path0

我的包裹

{
  "name": "my-project",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate"
  },
  "dependencies": {
    "@nuxtjs/axios": "^5.13.6",
    "@nuxtjs/vercel-builder": "^0.24.0",
    "@nuxtjs/vuetify": "^1.12.3",
    "@stripe/stripe-js": "^1.46.0",
    "cookie-parser": "^1.4.6",
    "cookieparser": "^0.1.0",
    "cors": "^2.8.5",
    "express": "^4.18.2",
    "gsap": "npm:@gsap/shockingly@^3.11.3",
    "nuxt": "^2.14.6",
    "nuxt-gsap-module": "^1.7.2",
    "stripe": "^11.3.0",
    "vuex-persistedstate": "^4.1.0"
  }
}
btqmn9zl

btqmn9zl1#

我通过在package.json中定义node.js版本来让它工作,如下所示:

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

相关问题