无法在Node.js 10.x中使用带有Windows 64位的node-sass?

问题描述 投票:5回答:1

我正在使用Node.js 10这是推荐的版本,只是尝试运行一个简单的gulp任务来编译一些SCSS文件。但是,我收到以下错误。

Node Sass找不到当前环境的绑定:带有Node.js 10.x的Windows 64位找到以下环境的绑定: - 带有Node.js 8.x的Windows 64位

这里完全错误

Failed to run "C:\Users\lee\Documents\Projects\Merch.Umb\Src\Merch.Web\Gulpfile.js"... cmd.exe /c gulp --tasks-simple C:\Users\lee\Documents\Projects\Merch.Umb\Src\Merch.Web\node_modules\node-sass\lib\binding.js:15
      throw new Error(errors.missingBinary());
      ^ Error: Missing binding C:\Users\lee\Documents\Projects\Merch.Umb\Src\Merch.Web\node_modules\node-sass\vendor\win32-x64-64\binding.node Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 10.x Found bindings for the following environments:
  - Windows 64-bit with Node.js 8.x This usually happens because your environment has changed since running `npm install`. Run `npm rebuild node-sass` to download the binding for your current environment.
    at module.exports (C:\Users\lee\Documents\Projects\Merch.Umb\Src\Merch.Web\node_modules\node-sass\lib\binding.js:15:13)
    at Object.<anonymous> (C:\Users\lee\Documents\Projects\Merch.Umb\Src\Merch.Web\node_modules\node-sass\lib\index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (C:\Users\lee\Documents\Projects\Merch.Umb\Src\Merch.Web\node_modules\gulp-sass\index.js:162:21)

我应该卸载v10并安装旧版本的Node.Js吗?

node.js gulp-sass node-sass
1个回答
1
投票

我认为这可以解决你的问题。

进入项目文件夹直到node-sass文件夹的位置,然后执行:

npm rebuild node-sass --force

替代方案是

删除node-saas和Do

npm install

© www.soinside.com 2019 - 2024. All rights reserved.