在学习组件库流程
打包的时候报错找不到module,后来改了版本又报错
Error: error:0308010C:digital envelope routines::unsupported
报错原因:node17+版本对发布的OpenSSL3.0, 而OpenSSL3.0对允许算法和密钥大小增加了严格的限制,可能会对生态系统造成一些影响.
解决方案:在网上搜索了很多,有三种解决方案,选了一种最方便的,就是修改配置方案,在build后面加上:set NODE_OPTIONS=--openssl-legacy-provider
"scripts": {
"serve": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --open",
"build": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
"lint": "vue-cli-service lint",
"build:js": "set NODE_OPTIONS=--openssl-legacy-provider && webpack --config ./webpack.components.js"
},
记一下我的版本:
"dependencies": {
"core-js": "^3.8.3",
"node": "^20.6.0",
"sass": "^1.68.0",
"vue": "^2.6.14",
"webpack": "^5.44.0",
"webpack-cli": "^5.0.1"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"sass-loader": "^13.3.2",
"vue-loader": "^15.10.0",
"vue-template-compiler": "^2.6.14"
}
标签:NODE,0308010C,vue,cli,--,routines,set,报错
From: https://www.cnblogs.com/cloud0-0/p/17733392.html