node.js Windows 10 上的 node-sass 安装问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46953808/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
node-sass installation issue on windows 10
提问by Giannis Savvidis
I have installed node js latest version(8.8.1) and npm latest version(5.5.1) and when i try to install node-sass i get this:
我已经安装了 node js 最新版本(8.8.1)和 npm 最新版本(5.5.1),当我尝试安装 node-sass 时,我得到了这个:
npm install -g node-sass
C:\Users\Giannis\AppData\Roaming\npm\node-sass -> C:\Users\Giannis\AppData\Roaming\npm\node_modules\node-sass\bin\node-sass
C:\Users\Giannis\AppData\Roaming\npm\node-sass -> C:\Users\Giannis\AppData\Roaming\npm\node_modules\node-sass\bin\node-sass
[email protected] install C:\Users\Giannis\AppData\Roaming\npm\node_modules\node-sass node scripts/install.js
[email protected] 安装 C:\Users\Giannis\AppData\Roaming\npm\node_modules\node-sass node scripts/install.js
'node' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node scripts/install.jsnpm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
'node' 不是内部或外部命令,也不是可运行的程序或批处理文件。npm 错误!代码 ELIFECYCLE npm ERR!错误号 1 npm 错误号![email protected] 安装:node scripts/install.jsnpm ERR!退出状态 1 npm ERR!npm 错误!在 [email protected] 安装脚本中失败。npm 错误!这可能不是 npm 的问题。上面可能有额外的日志输出。
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Giannis\AppData\Roaming\npm-cache_logs\2017-10-26T11_57_10_751Z-debug.log
错误!可以在以下位置找到此运行的完整日志:npm ERR!C:\Users\Giannis\AppData\Roaming\npm-cache_logs\2017-10-26T11_57_10_751Z-debug.log
I have set the system variable C:\Program Files\nodejs\
我已经设置了系统变量 C:\Program Files\nodejs\
Thanks
谢谢
回答by Gabriel Bleu
node-sass requires node-gyp https://github.com/sass/node-sass#install
node-sass 需要 node-gyp https://github.com/sass/node-sass#install
node-gyp requires windows-build-tools https://github.com/nodejs/node-gyp#on-windows
node-gyp 需要 windows-build-tools https://github.com/nodejs/node-gyp#on-windows
Install all the required tools and configurations using Microsoft's windows-build-toolsusing
npm install --global --production windows-build-toolsfrom an elevated PowerShell or CMD.exe (run as Administrator).
安装使用微软的所有必要的工具和配置Windows的构建工具使用
npm install --global --production windows-build-tools从提升的PowerShell或cmd.exe,(以管理员身份运行)。

