Syntax Error  Error  Node Sass does not yet support your current environment  Windows 64-bit with Unsupported runtime (111),Error  error:0308010C digital envelope routines unsupported

Syntax Error Error Node Sass does not yet support your current environment Windows 64-bit with Unsupported runtime (111),Error error:0308010C digital envelope routines unsupported

前段时间稀里糊涂的把Node升级到了v19.6.1,升级之前也没考虑到之前一些项目的依赖,升级之后也就有过多关注其带来的影响。在最近运行的时候,才发现出问题了。

问题1

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

这时候,需要在运行前面加一个set NODE_OPTIONS=--openssl-legacy-provider,我们可以直接配置在package.json中。

问题2

1
2
3
4
5
6
7

ERROR Failed to compile with 1 error 10:22:16
error in ./src/components/com/comScss.scss

Syntax Error: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (111)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1

从上面的日志,我们大致能看出,是Node Sass版本不支持。那么,我们就去看一下Node SaasNode的版本对应关系https://www.npmjs.com/package/node-sass

我到package.json看到我们使用的是

1
2
"node-sass": "^4.12.0",
"sass-loader": "^8.0.0",

现在,将node-sass改为8.0.0,再删除node_modules,重新安装,又出现

1
Syntax Error: Error: Node Sass version 8.0.0 is incompatible with ^4.0.0.

这还是版本问题,

Node-sass 版本 Sass-loader 版本
8.x ^12.1.0
7.x ^11.0.0
6.x ^10.0.0
5.x ^9.0.0
4.x ^8.0.0

那就把sass-loader是版本升高一点

1
"sass-loader": "^10.4.1",

重新安装,OK,可以运行起来了。不能直接升到最新版本,否则会报Syntax Error:TypeError: this.getOptions is not a function。其实这一切的错误都是因为Node版本和各个组件的依赖版本导致的。

Syntax Error Error Node Sass does not yet support your current environment Windows 64-bit with Unsupported runtime (111),Error error:0308010C digital envelope routines unsupported

https://blogs.52fx.biz/posts/678793841.html

作者

eyiadmin

发布于

2023-05-10

更新于

2024-05-31

许可协议

评论