node-sass安装失败,安装后无法使用 gyp verb check python checking for Python executable "python2" in the PATH

E:\works\store-guide-manage-react>yarn install
yarn install v1.16.0
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order
to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=5".
warning "@typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] Building fresh packages...
[-/4] ⠂ waiting...
[2/4] ⠂ node-sass
[-/4] ⠄ waiting...
error E:\works\store-guide-manage-react\node_modules\node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: E:\works\store-guide-manage-react\node_modules\node-sass
Output:
Building: D:\Program Files\node.exe E:\works\store-guide-manage-react\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 [ 'D:\\Program Files\\node.exe',
gyp verb cli   'E:\\works\\store-guide-manage-react\\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 [email protected]
gyp info using [email protected] | 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:\works\store-guide-manage-react\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (E:\works\store-guide-manage-react\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (E:\works\store-guide-manage-react\node_modules\which\which.js:80:29)
gyp verb `which` failed     at E:\works\store-guide-manage-react\node_modules\which\which.js:89:16
gyp verb `which` failed     at E:\works\store-guide-manage-react\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at E:\works\store-guide-manage-react\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:\works\store-guide-manage-react\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (E:\works\store-guide-manage-react\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (E:\works\store-guide-manage-react\node_modules\which\which.js:80:29)
gyp verb `which` failed     at E:\works\store-guide-manage-react\node_modules\which\which.js:89:16
gyp verb `which` failed     at E:\works\store-guide-manage-react\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at E:\works\store-guide-manage-react\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed   stack:
gyp verb `which` failed    'Error: not found: python2\n    at getNotFoundError (E:\\works\\store-guide-manage-react\\node_modules\\which\\which.js:13:12)\n    at F (E:\\works\\store-guide-manage-react\\node_modules\\which\\which.js:68:19)\n    at E (E:\\works\\store-guide-manage-react\\node_modules\\which\\which.js:80:29)\n    at E:\\works\\store-guide-manage-react\\node_modules\\which\\which.js:89:16\n    at E:\\works\\store-guide-manage-react\\node_modules\\isexe\\index.js:42:5\n    at E:\\works\\store-guide-manage-react\\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:\works\store-guide-manage-react\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (E:\works\store-guide-manage-react\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (E:\works\store-guide-manage-react\node_modules\which\which.js:80:29)
gyp verb `which` failed     at E:\works\store-guide-manage-react\node_modules\which\which.js:89:16
gyp verb `which` failed     at E:\works\store-guide-manage-react\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at E:\works\store-guide-manage-react\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:\works\store-guide-manage-react\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (E:\works\store-guide-manage-react\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (E:\works\store-guide-manage-react\node_modules\which\which.js:80:29)
gyp verb `which` failed     at E:\works\store-guide-manage-react\node_modules\which\which.js:89:16
gyp verb `which` failed     at E:\works\store-guide-manage-react\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at E:\works\store-guide-manage-react\node_modules\isexe\windows.js:36:5
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 (E:\\works\\store-guide-manage-react\\node_modules\\which\\which.js:13:12)\n    at F (E:\\works\\store-guide-manage-react\\node_modules\\which\\which.js:68:19)\n    at E (E:\\works\\store-guide-manage-react\\node_modules\\which\\which.js:80:29)\n    at E:\\works\\store-guide-manage-react\\node_modules\\which\\which.js:89:16\n    at E:\\works\\store-guide-manage-react\\node_modules\\isexe\\index.js:42:5\n    at E:\\works\\store-guide-manage-react\\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 ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (E:\works\store-guide-manage-react\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder. (E:\works\store-guide-manage-react\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at callback (E:\works\store-guide-manage-react\node_modules\graceful-fs\polyfills.js:295:20)
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "D:\\Program Files\\node.exe" "E:\\works\\store-guide-manage-react\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd E:\works\store-guide-manage-react\node_modules\node-sass
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0

这个问题搞了一会想起开始安装node-sass时的一句被我忽略的提示:执行npm rebuild node-sass
这行后就可以了

再说说 node-sass 的安装问题,现在使用 yarn install 时容易出现node-sass无法安装的情况,npm也无法安装。主要还是因为墙的原因。
出现这个问题还是去安装个 taobao 镜像吧,虽然我也不太喜欢使用。但它能解决这种问题

你可能感兴趣的:(node-sass安装失败,安装后无法使用 gyp verb check python checking for Python executable "python2" in the PATH)