【问题标题】:gyp verb `which` failed Error: not found: python2 for yarn add node-sass commandgyp动词`which`失败错误:未找到:python2 for yarn add node-sass命令
【发布时间】:2019-08-30 09:53:33
【问题描述】:

我正在开发一个项目,需要将 sass 加载器添加到我的项目依赖项中,该依赖项需要节点 sass 才能工作。我用

安装了 sass 加载器
yarn add sass-loader@6.0.6

而且效果很好。但是当我尝试使用这个安装 node-sass 时:

yarn add node-sass@4.5.3

warning " > react-modal@2.2.2" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0".
[4/4] Building fresh packages...
[-/3] ⢀ waiting...
[-/3] ⠠ waiting...
error C:\Users\IT\Desktop\react-course-projects\indecision-app\node_modules\node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: C:\Users\IT\Desktop\react-course-projects\indecision-app\node_modules\node-sass
Output:
Building: C:\Program Files\nodejs\node.exe C:\Users\IT\Desktop\react-course-projects\indecision-app\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using node-gyp@3.8.0
gyp info using node@10.16.3 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure [],
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (C:\Users\IT\Desktop\react-course-projects\indecision-app\node_modules\which\which.js:13:12)
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed   stack:
gyp verb `which` failed    'Error: not found: python\n    at getNotFoundError 
gyp verb `which` failed   code: 'ENOENT' }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp verb check python version `C:\Python27\python.exe -c "import sys; print "2.7.0
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 10.16.3
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\\Users\\IT\\Desktop\\react-course-projects\\indecision-app\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\IT\\Desktop\\react-course-projects\\indecision-app\\node_modules\\node-sass',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\IT\\Desktop\\react-course-projects\\indecision-app\\node_modules\\node-sass\\build',
gyp info spawn args   '-Goutput_dir=.' ]
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir C:\Users\IT\.node-gyp\10.16.3
gyp verb found first Solution file build/binding.sln
gyp verb could not find "msbuild.exe" in PATH - finding location in registry
gyp ERR! build error
gyp ERR! stack Error: Command failed: reg query "HKLM\Software\Microsoft\MSBuild\ToolsVersions" /s /reg:32
gyp ERR! stack 'reg' is not recognized as an internal or external command,
gyp ERR! stack operable program or batch file.
gyp ERR! stack
gyp ERR! stack Can't find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed?gyp ERR! stack     at C:\Users\IT\Desktop\react-course-projects\indecision-app\node_modules\node-gyp\lib\build.js:142:25
"C:\\Users\\IT\\Desktop\\react-course-projects\\indecision-app\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\IT\Desktop\react-course-projects\indecision-app\node_modules\node-sass
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok`enter code here`

我尝试删除节点模块并将其重新安装我没有工作 节点-v 10.16.0 npm -v 6.9.0

【问题讨论】:

    标签: yarnpkg node-gyp node-sass


    【解决方案1】:

    看起来 sass-loader@6.0.6 使用了 node-sass 不支持的较旧的 node-sass 依赖项。我会尝试使用 sass-loader@latest 来查看它是否至少使用 node-sass 4.9 来支持 Node 10 https://github.com/sass/node-sass#supported-nodejs-versions-vary-by-release-please-consult-the-releases-page-below-is-a-quick-guide-for-minimum-support

    【讨论】:

      猜你喜欢
      • 2018-08-04
      • 2022-07-22
      • 1970-01-01
      • 2019-04-03
      • 2020-06-09
      • 2022-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多