E:\A Prem World\Team_Work_Tasks\Anjali\Anjali_20160524\QuizApp_20160524_01_Anj>ionic serve -l
(node:4772) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
There is an error in your gulpfile:
Error: Node Sass does not yet support your current environment: Windows 64-bit with false
For more information on which environments are supported please see:
TODO URL
    at Object.<anonymous> (E:\A Prem World\Team_Work_Tasks\Anjali\Anjali_20160524\QuizApp_20160524_01_Anj\node_modules\node-sass\lib\index.js:12:11)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (E:\A Prem World\Team_Work_Tasks\Anjali\Anjali_20160524\QuizApp_20160524_01_Anj\node_modules\gulp-sass\index.js:187:21)
    at Module._compile (module.js:541:32)

当前回答

在我的情况下,问题是当我安装节点的最新版本,即;10.6.0. 同样的错误显示并参考@Quinn卸载该版本并安装8.11.3 LTS版本。现在工作很好:)

其他回答

下面是node和node-sass兼容版本列表。

NodeJS  Supported node-sass version *
Node    15        5.0+   
Node    14        4.14+ 
Node    13        4.13+, < 5.0   
Node    12        4.12+  
Node    11        4.10+, < 5.0   
Node    10        4.9+   
Node     8        4.5.3+, < 5.0  
Node  <  8   <    5.0     < 57

如果问题存在,请升级或降级版本。

在我的例子中,这与节点版本有关。

我的项目使用的是12.18.3,但我使用的是14.5.0

所以npm rebuild node-sass没有在错误的节点版本(14.5.0)上解决这个问题。

我切换到正确的版本(12.18.3),所以它可以工作。

我有一个类似的错误与sass包,我修复了以下步骤:

在确定错误是由于版本不兼容导致的之后,列出可用的版本:

npm view node-sass versions

我的版本是'5.0.0',所以我把它降级到之前的版本(在我的例子中是'4.14.1'):

npm uninstall node-sass

npm install node-sass@4.14.1

瞧,只需要一个版本步骤,在其他情况下可能需要几个,这取决于项目的年代或需求。

当使用Visual Studio中的任务运行器资源管理器时,确保你优先选择正确的PATH。

还要确保,一旦你改变优先级,重新启动VS。

$(PATH)指向默认节点路径 .\node_modules\.bin指向本地项目路径

因此,当您使用NVM切换节点版本时,您应该选择系统路径。

如果你使用NVM, VS Code和VS Code任务资源管理器来运行使用node-sass的npm脚本,下面的警告将为你节省一些时间。

I was using VS Code's Task Explorer to run my scripts and have installed multiple Node versions using NVM, defaulting to the current latest version 16. When I opened my VS Code repository and ran nvm use 10 in a new terminal, the Node and npm version in that terminal window correctly downgrades, but the version of node/npm used by the Task Explorer runner remained at Node 16. So when running my webpack script using the VS Code Task Runner, node-sass would still throw the environment error of this question.

解决方案是不使用VS Code任务运行器,在你改变节点版本的终端上运行你的脚本,或者使用下面的命令改变默认的NVM节点版本,重新启动VS Code,然后使用任务资源管理器/运行器。

NVM别名默认10(或任何你需要node-sass兼容性的版本)