欢迎光临
我们一直在努力

gyp verb check python checking for Python executable “python2” in the PATH和win32-x64-57_binding.node错误解决方法

今天在boot-cms项目下执行npm install时出现如下错误,全部执行记录如下:

E:\phpStudy\WWW\bootstrap-cms>npm install

> node-sass@3.13.1 install E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node":

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> node-sass@3.13.1 postinstall E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass
> node scripts/build.js

Building: C:\Program Files\nodejs\node.exe E:\phpStudy\WWW\bootstrap-cms\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\node-gyp\\bin\\node-gyp.js',
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.6.2
gyp info using node@8.7.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:80:29)
gyp verb `which` failed     at E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:89:16
gyp verb `which` failed     at E:\phpStudy\WWW\bootstrap-cms\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at E:\phpStudy\WWW\bootstrap-cms\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:80:29)
gyp verb `which` failed     at E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:89:16
gyp verb `which` failed     at E:\phpStudy\WWW\bootstrap-cms\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at E:\phpStudy\WWW\bootstrap-cms\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed   stack: 'Error: not found: python2\n    at getNotFoundError (E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\which\\which.js:13:12)\n    at F (E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\which\\which.
js:68:19)\n    at E (E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\which\\which.js:80:29)\n    at E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\which\\which.js:89:16\n    at E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\ise
xe\\index.js:42:5\n    at E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\isexe\\windows.js:36:5\n    at FSReqWrap.oncomplete (fs.js:153:21)',
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 (E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:80:29)
gyp verb `which` failed     at E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:89:16
gyp verb `which` failed     at E:\phpStudy\WWW\bootstrap-cms\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at E:\phpStudy\WWW\bootstrap-cms\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed  python { Error: not found: python
gyp verb `which` failed     at getNotFoundError (E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:80:29)
gyp verb `which` failed     at E:\phpStudy\WWW\bootstrap-cms\node_modules\which\which.js:89:16
gyp verb `which` failed     at E:\phpStudy\WWW\bootstrap-cms\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at E:\phpStudy\WWW\bootstrap-cms\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed   stack: 'Error: not found: python\n    at getNotFoundError (E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\which\\which.js:13:12)\n    at F (E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\which\\which.j
s:68:19)\n    at E (E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\which\\which.js:80:29)\n    at E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\which\\which.js:89:16\n    at E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\isex
e\\index.js:42:5\n    at E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\isexe\\windows.js:36:5\n    at FSReqWrap.oncomplete (fs.js:153:21)',
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 platform; print(platform.python_version());"` returned: "2.7.3\r\n"
gyp verb get node dir no --target version specified, falling back to host node version: 8.7.0
gyp verb command install [ '8.7.0' ]
gyp verb install input version string "8.7.0"
gyp verb install installing version: 8.7.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 8.7.0
gyp verb build dir attempting to create "build" dir: E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build
gyp verb build dir "build" dir needed to be created? E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\config.gypi
gyp verb config.gypi checking for gypi file: E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\config.gypi
gyp verb common.gypi checking for gypi file: E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'E:\\phpStudy\\WWW\\bootstrap-cms\\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=2012',
gyp info spawn args   '-I',
gyp info spawn args   'E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\node-sass\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\administrator\\.node-gyp\\8.7.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\administrator\\.node-gyp\\8.7.0',
gyp info spawn args   '-Dnode_gyp_dir=E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\administrator\\.node-gyp\\8.7.0\\<(target_arch)\\node.lib', gyp info spawn args '-Dmodule_root_dir=E:\\phpStudy\\WWW\\bootstrap-cms\\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 'E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\node-sass\\build', gyp info spawn args '-Goutput_dir=.' ] gyp verb command build [] gyp verb build type Release gyp verb architecture x64 gyp verb node dev dir C:\Users\administrator\.node-gyp\8.7.0 gyp verb found first Solution file build/binding.sln gyp verb could not find "msbuild.exe" in PATH - finding location in registry gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe gyp info spawn args [ 'build/binding.sln', gyp info spawn args '/nologo', gyp info spawn args '/p:Configuration=Release;Platform=x64' ] Build started 2017/11/3 11:18:34. Project "E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\binding.sln" on node 1 (default targets). ValidateSolutionConfiguration: Building solution configuration "Release|x64". Project "E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\binding.sln" (1) is building "E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\binding.vcxproj.metaproj" (2) on node 1 (default targets). Project "E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\binding.vcxproj.metaproj" (2) is building "E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\src\libsass.vcxproj" (3) on node 1 (default targets). E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: The imported project "E:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is corre ct, and that the file exists on disk. Done Building Project "E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\src\libsass.vcxproj" (default targets) -- FAILED. Done Building Project "E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\binding.vcxproj.metaproj" (default targets) -- FAILED. Done Building Project "E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\binding.sln" (default targets) -- FAILED. Build FAILED. "E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\binding.sln" (default target) (1) ->
"E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\binding.vcxproj.metaproj" (default target) (2) ->
"E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\src\libsass.vcxproj" (default target) (3) ->
  E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass\build\src\libsass.vcxproj(20,3): error MSB4019: The imported project "E:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the  declaration is cor
rect, and that the file exists on disk.

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.17
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (E:\phpStudy\WWW\bootstrap-cms\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "E:\\phpStudy\\WWW\\bootstrap-cms\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_librar
y="
gyp ERR! cwd E:\phpStudy\WWW\bootstrap-cms\node_modules\node-sass
gyp ERR! node -v v8.7.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@3.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@3.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\administrator\AppData\Roaming\npm-cache\_logs\2017-11-03T03_18_47_484Z-debug.log

发现有一行提示:

Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node

Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node":

HTTP error 404 Not Found

在 node scripts/install.js 之后发现这么一句话

Cannot download "https://github.com/sass/node-sass/releases/download/v4.5.3/win32-x64-57_binding.node":

在网上下载,如果报错的版本和我的一样,可以用我下载好的文件  点击下载

下载完了之后把它注册成全局环境变量,两种方式:

第一种:直接右键我的电脑–》属性–》高级系统设置–》环境变量–》添加

第二种:set XXX=文件路经–》set SASS_BINARY_PATH=F:\ww\tools\node-sass\win32-x64-57_binding.node

查看环境是否合适:echo %SASS_BINARY_PATH%

如果打印出来您配置好的文件地址那就ok了,

最后再来试试安装:npm i -g node-sass

总结:

笔者经过多种不同环境,不同错误的尝试,大概总结如下,

1、个别时是因国内网速问题,导致无法正常安装。

2、使用添加至环境变量的解决方法,基本能解决问题。

3、使用添加环境变量的方法解决时要注意node-sass版本的要与nodejs的版本相一致。

以下是查看node-sass相对应 binding.node版本 的方法

https://www.npmjs.com/package/node-sass

NodeJSMinimum node-sass versionNode Module
Node 144.14+83
Node 134.13+79
Node 124.12+72
Node 114.10+67
Node 104.9+64
Node 84.5.3+57

(1)使用node -v 查看nodejs版本:

(2)另附node-sass的最新版本

https://github.com/sass/node-sass/releases

赞(1)
版权归原作者所有,如有侵权请告知。达维营-前端网 » gyp verb check python checking for Python executable “python2” in the PATH和win32-x64-57_binding.node错误解决方法

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址