在没有Python的情况下使用npm安装scss-lint

Jer*_*oen 5 npm gulp node-sass scss-lint

我正试图gulp-scss-lint在我的机器上工作,但是这样做有困难.

上下文

我有一种感觉特定的版本和环境设置可能对我的问题很重要,所以让我列出我的具体背景:

  • Windows Server 2012 R2标准版
  • NPM 2.14.7
  • 节点4.2.2
  • 已安装Gulp 3.9.0 -g
  • 从Powershell 4.0运行

摄制

这是我的问题的一个重复:

  1. mkdir gulpscsslintcd gulpscsslint
  2. npm init 所有默认答案
  3. npm install gulp --save-dev
  4. npm install gulp-scss-lint --save-dev
  5. new-item -itemtype file gulpfile.js 并输入:

    var gulp = require('gulp'), lint = require('gulp-scss-lint');
    gulp.task('default', [], function() {
      return gulp.src('*.scss').pipe(lint());
    });
    
    Run Code Online (Sandbox Code Playgroud)
  6. new-item -itemtype file styles.scss

  7. gulp

结果:

 [08:48:50] Using gulpfile ~\experiments\gulpscsslint\gulpfile.js
 [08:48:50] Starting 'default'...
 [08:48:50] 'default' errored after 32 ms
 [08:48:50] Error in plugin 'gulp-scss-lint'
 Message:
     Error code 1
 Error: Command failed: C:\Windows\system32\cmd.exe /s /c "scss-lint 'styles.scss' --format=JSON"
 'scss-lint' is not recognized as an internal or external command,
 operable program or batch file.
Run Code Online (Sandbox Code Playgroud)

预期结果显然是来自棉绒的实际产量.

那么我接着说:

  1. npm install scss-lint --save-dev

但它失败了failNoPython,从输出的这个片段:

 Can not download file from https://raw.githubusercontent.com/sass/node-sass-binaries/v2.1.1/win32-x64-node-4.2/binding.node
 gyp ERR! configure error
 gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable
Run Code Online (Sandbox Code Playgroud)

使用Python安装此Node包真的是一个很难的要求吗?或者可以以某种方式安装而无需安装Python?

作为一个脚注,现在我已经完全写了这个问题,我意识到这可能更像是一个Github问题,但如果是这样的话,我可能需要一些帮助(学习如何)找到(包括)给我的包或工具麻烦(gulp-scss-lintscss-lintnpmnode-sass或一些其它底层包?).

RuH*_*uHa 1

您可以通过克隆或直接从github 存储库下载该包并将其放入您的目标位置来手动安装该包。

笔记:

node-gyp 是一个用 Node.js 编写的跨平台命令行工具,用于为 Node.js 编译本机插件模块。关联

这个包需要Python才能工作。包括npmnpminstall在内的数百个包都依赖于 node-gyp 来编译。在 Windows 上,可以安装 windows-build-tools 包(其中包括 python)来使用 node-gyp。