解决vue Error: Node Sass version 6.0.1 is incompatible with ^4.0.0.和ERROR in Cannot find module ‘node-sass’

本文最后更新于2022.05.11-19:48,某些文章具有时效性,若有错误或已失效,请在下方留言或联系涛哥

错误信息描述

npm install 

ERROR in Cannot find module 'node-sass'

Module build failed: Error: Node Sass version 6.0.1 is incompatible with ^4.0.0.Error: Node Sass version 6.0.1 is incompatible with ^4.0.0.

原因分析

没有找到node-nass

node-nass 版本过高,需要卸载重新安装

 解决方法

1,没有找到node-nass

npm install node-sass 或 cnpm install node-sass@latest

特别注意的是:

  1. 如果你是用cmd就直接安装即可
  2. Windows Powershell:

cnpm : 无法加载文件 C:\Users\aa152\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本

找到搜索按钮输入 window powershell运行下面的命令即可

 2,node-nass 版本过高,先卸载掉之前的版本重新安装指定版本

1、卸载:$ npm uninstall node-sass

2、安装:$ npm install node-sass@4.14.1

3、运行:$ npm run dev

阅读剩余
THE END