欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 房产 > 建筑 > vue-cli 老项目升级依赖心得 node-sass 问题的处理

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

2024/10/24 10:24:08 来源:https://blog.csdn.net/u010263423/article/details/143024134  浏览:    关键词: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,我拿其中一个来举例子
    在这里插入图片描述

    npm uninstall node-sassnpm install sass-loader@7 --save-dev
    

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

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

(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:79this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHashCache());

应该是 webpack 太老了

问题

在这里插入图片描述

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com