Node.js upgrade error digital envelope routines unsupporte the simplest solution

Background: Locally upgrade nodejs 16 to nodejs18 and report an error digital envelope routines::unsupported

report error

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)

source code


"scripts": {
    
    
    "dev": "vue-cli-service serve",
    "build": "vue-cli-service build",
}

replace with

"scripts": {
    
    
    "dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
    "build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build" , 
}

Re-execute npm run dev

Guess you like

Origin blog.csdn.net/gjwgjw1111/article/details/129761236