node.js - 无法在带有 Node.js 10.x 的 64 位 Windows 上使用 node-sass?
问题描述
我正在使用推荐版本的 Node.js 10,并且只是尝试运行一个简单的 gulp 任务来编译一些 SCSS 文件。但是,我收到以下错误。
Node Sass 找不到当前环境的绑定:Windows 64-bit with Node.js 10.x 找到了以下环境的绑定:- Windows 64-bit with Node.js 8.x
这里完全错误
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-sass 文件夹的位置,然后执行:
npm rebuild node-sass --force
替代方案是
删除node-saas
并执行
npm install
推荐阅读
- javascript - 以编程方式将 API 响应过滤为查询参数
- javascript - 为什么我的 javascript 小部件不允许我调整大小?
- java - 使用 Antlr 解析代码后如何检测 for 循环块?
- node.js - 努力将我的 node.js 应用程序上传到天蓝色
- pyramid - 如何使用 Pyramid 在我的计算机上以绝对路径托管静态文件?
- robots.txt - ReadTheDocs robots.txt 和 sitemap.xml
- express - 请求标头中包含 Cookie,但 express 返回空 Cookie(使用 Amazon 负载均衡器)
- node.js - Nodejs 中的函数
- python - django-filter FilterSet 行为是否与跨多值关系的查询的原生 Django 行为一致?
- serverless - 如何使用无服务器框架在单个 serverless.yml 文件中创建不同的阶段或环境?