vue-cli 老项目升级依赖心得 node-sass 问题的处理

问题

  • 老项目只能用 node8 来启动,而且安装依赖的时候还跟 python 版本有关系,查了查是 node-sass 这个依赖包的问题

解决

  • 首先我卸载了node-sass,替换成 sass

  • 然后尝试 sass-loader 版本的配置,改成 "sass-loader": "^7.3.1", 了,这个版本要和你当前的 "webpack": "4.16.5", 版本兼容,我刚开始安装的是 sass-loader8,往下降级试了试,7是可以的

  • 然后就是全文替换 /deep/::v-deep,我拿其中一个来举例子

    bash 复制代码
    npm uninstall node-sass
    
    npm install sass-loader@7 --save-dev

(node:46563) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.

当我从 node 12 切换到 node20时 又报错了

javascript 复制代码
(node:46563) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:46563) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
 10% building modules 1/2 modules 1 active .../node_modules/webpack/hot/dev-server.jsnode:internal/crypto/hash:79
  this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHashCache());

应该是 webpack 太老了

相关推荐
时空系3 小时前
认识Rust——我的第一个程序 Rust中文编程
开发语言·后端·rust
时空系4 小时前
第10篇:归属权与借用——Rust的安全保障 Rust中文编程
开发语言·安全·rust
时空系4 小时前
第6篇:数据容器——管理大量数据 Rust中文编程
开发语言·后端·rust
时空系5 小时前
第7篇:功能——打造你的工具箱 Rust中文编程
开发语言·网络·rust
Python私教5 小时前
Pure-Admin-Thin 深度解析:完整版和精简版到底怎么选?
vue.js·人工智能·开源
ayqy贾杰7 小时前
Cursor SDK发布!开发者可直接搬走其内核
前端·vue.js·面试
qcx237 小时前
拆解 Warp AI Agent(五):跨生态联邦——10 种 Skill + MCP + 多 Harness 互操作设计
人工智能·rust·ai agent·skill·warp·mcp·harness
李白的天不白8 小时前
vue 数据格式问题
前端·vue.js·windows
小白蒋博客8 小时前
【ai开发段永平投资理财的知识图谱网站】第一天:搭 Vite + Vue 项目,跑通 Hello World
vue.js·人工智能·trae