错误日志:

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

[app-scripts]node_modules\_node-sass@4.5.0@node-sass\lib\binding.js:13
[app-scripts]       throw new Error(errors.unsupportedEnvironment());
[app-scripts]       ^
[app-scripts] Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (72)[app-scripts] For more information on which environments are supported please see:
[app-scripts] https://github.com/sass/node-sass/releases/tag/v4.5.0
[app-scripts]     at module.exports (H:\workspace\angular\aa\node_modules\_node-sass@4.5.0@node-sass\lib\binding.js:13:13)
[app-scripts]     at Object.<anonymous> (H:\workspace\angular\aa\node_modules\_node-sass@4.5.0@node-sass\lib\index.js:14:35)
[app-scripts]     at Module._compile (internal/modules/cjs/loader.js:936:30)
[app-scripts]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
[app-scripts]     at Module.load (internal/modules/cjs/loader.js:790:32)
[app-scripts]     at Function.Module._load (internal/modules/cjs/loader.js:703:12)
[app-scripts]     at Module.require (internal/modules/cjs/loader.js:830:19)
[app-scripts]     at require (internal/modules/cjs/helpers.js:68:18)
[app-scripts]     at Object.<anonymous> (H:\workspace\angular\aa\node_modules\_@ionic_app-scripts@1.3.7@@ionic\app-scripts\dist\core\bundle-components.js:6:16)
[app-scripts]     at Module._compile (internal/modules/cjs/loader.js:936:30)
环境:

在这里插入图片描述

node:12.9.1;
node-sass:4.13.1;

解决

尝试过网上说的各种方法:
1. 卸载重装;
2. 安装最新的;
3. 设置路径后重装

//两个set选一个尝试
set SASS_BINARY_PATH=D:\win32-x64-64_binding.node
set SASS_BINARY_PATH=D:\win32-x64-57_binding.node
npm install node-sass

都没有解决。。。很难受。
决定好好看看分析一下日志:
For more information on which environments are supported please see:
[app-scripts] https://github.com/sass/node-sass/releases/tag/v4.5.0
上面提到了去那个地址看一下:就去看一下
在这里插入图片描述
由上图发现最高4.5版本的node-sass最高支持node是7;
确实由于是老项目,在node7.0.0环境能运行。
但是现在我的node是12,node-sass也是最新的4.13;
按理说没问题的!
但是报错提示却是 tag/v4.5.0
由此想到项目中的node_modules中安装的依赖还是老版本4.5.0;
去看看。。。
在这里插入图片描述
果然发现4.5.0
在这里插入图片描述
将node_modules/node-sass文件夹删除,尝试重新安装 node-sass;
安装好了后,结果还是不能运行!

Error: ENOENT: no such file or directory, scandir 'H:\dscomm\workspace\angular\shenzhen\mit-a-ga-sz\node_modules\_node-sass@4.13.1@node-sass\vendor'

去查看了一下对应的文件夹。发现真的没有这个文件 vendor
直觉告诉我,应该安装的不对!还是有问题。
重新安装:

!!!先设置一下路径
PS H:\aaz> set SASS_BINARY_PATH=D:\win32-x64-64_binding.node
PS H:\aa> cnpm install node-sass

最后运行项目没问题了!

总结

1. 删除老的node-sass文件夹(先备份一下);
2. set SASS_BINARY_PATH=D:\win32-x64-64_binding.node
3. cnpm install node-sass

为了解决这个问题花费了好几个小时,心力交瘁。记录一下解决过程。

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐