0


node.js 14 升级 node.js 18

**一、准备 **

卸载node14,安装node18 https://nodejs.org/en

备份项目node_modules目录

准备python3+安装包 https://www.python.org/downloads/release/python-3120/

**二、更改配置文件 **

1.package.json

"node-sass": "^4.14.1",
 "sass-loader": "8.0.2",
 改为
"node-sass": "^8.0.0",
"sass-loader": "^10.4.1",

//node与node-sass 版本对应
https://www.npmjs.com/package/node-sass/v/8.0.0?activeTab=versions

2.vue.config.js

//如果有的话
 css: {
 loaderOptions: {
sass: {
additionaData: `@import"@/assets/scss/_variable.scss";`,
},
},
},
//additionaData
https://blog.csdn.net/qq_45376257/article/details/126215786

****报错 **

**An import loop has been found **

https://cloud.tencent.com/developer/article/1837424

然后我复制一份放到/assets/scss/目录下,修改为

 css: {
 loaderOptions: {
 sass: {
 additionalData: `@import "@/assets/scss/element-variables.scss";`
} 
}
}

复制

成功出现el-buttion标签, 解决问题

**options has an unknown property ‘prependData’. These **properties **are valid: **

**object { implementation?, sassOptions?, additionalData?, sourceMap?, **

**webpackImporter? } **

https://blog.csdn.net/qq_45376257/article/details/126215786

cass

根据项目的根路径的vue.config.js中

 css: {
 loaderOptions: {
 sass: {
 additionaData: `@import"@/assets/scss/_variable.scss";`,
 },
 },
 },

这里的是sass-loader:12.0.0cass-locader的版本不同,additionaData****也会不同

*sass-loader:v10以上就用:*additionaData **

*sass-loader:v8以上就用:*prependData **

**sass-loader:v8-以下就用:data **

**Error: error:0308010C:digital envelope routines::unsupported **

https://www.cnblogs.com/jaxu/p/17171211.html

https://blog.csdn.net/m0_65933139/article/details/130690790

https://blog.csdn.net/kajing6092/article/details/130387375

 set NODE_OPTIONS=--openssl-legacy-provider

package.json增加配置

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

**npm ERR! gyp info it worked if it ends with oknpm ERR! **

**gyp verb cli **

1 npm install -g mirror-config-china --registry=

https://registry.npmmirror.com

npm install -g mirror-config-china --registry=

2 npm install node-sassnpm ERR! code 1 npm ERR! path D:\LeChuang\three_3D\vueThree

**master\node_modu **


 "node-sass": "^8.0.0",
 "sass-loader": "10.4.1",
标签: 开发语言 vue 前端

本文转载自: https://blog.csdn.net/qq_52588299/article/details/138066234
版权归原作者 ༀ༺风༒烛༻ༀ 所有, 如有侵权,请联系我们删除。

“node.js 14 升级 node.js 18”的评论:

还没有评论