问题
- 老项目只能用
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-sass npm 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:79
this[kHandle] = new _Hash(algorithm, xofLen, algorithmId, getHashCache());
应该是 webpack
太老了