解决gyp verb `which` failed python2 Error: not found: python2

运行老项目遇到如下报错

PS C:\Users\demo02> yarn install
yarn install v1.22.19
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
warning [email protected]: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning element-ui > async-validator > babel-runtime > [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js. 
warning @babel/register > [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning @vue/cli-plugin-babel > @vue/cli-shared-utils > @hapi/[email protected]: Switch to 'npm install joi'
warning @vue/cli-plugin-babel > @vue/cli-shared-utils > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning @vue/cli-plugin-babel > @vue/cli-shared-utils > [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
warning @vue/cli-plugin-babel > @vue/babel-preset-app > [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature 
detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning @vue/cli-plugin-babel > @vue/cli-shared-utils > @hapi/joi > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning @vue/cli-plugin-babel > @vue/cli-shared-utils > @hapi/joi > @hapi/[email protected]: Moved to 'npm install @sideway/address'
warning @vue/cli-plugin-babel > @vue/cli-shared-utils > @hapi/joi > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning @vue/cli-plugin-babel > @vue/cli-shared-utils > @hapi/joi > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning @vue/cli-plugin-babel > @vue/cli-shared-utils > @hapi/joi > @hapi/topo > @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
warning @vue/cli-plugin-babel > @vue/cli-shared-utils > request > [email protected]: this library is no longer supported
warning @vue/cli-plugin-babel > @vue/cli-shared-utils > request > [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning @vue/cli-plugin-babel > webpack > [email protected]: This is probably built in to whatever tool you're using. If you still need it... idk
warning @vue/cli-plugin-babel > @vue/babel-preset-app > @babel/runtime-corejs2 > [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the 
V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning @vue/cli-plugin-babel > webpack > watchpack > watchpack-chokidar2 > [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
warning @vue/cli-plugin-babel > webpack > micromatch > snapdragon > [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
warning @vue/cli-plugin-babel > webpack > node-libs-browser > url > [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning @vue/cli-plugin-babel > webpack > watchpack > watchpack-chokidar2 > chokidar > [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning @vue/cli-plugin-babel > webpack > micromatch > snapdragon > source-map-resolve > [email protected]: See https://github.com/lydell/source-map-url#deprecated
warning @vue/cli-plugin-babel > webpack > micromatch > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
warning @vue/cli-plugin-babel > webpack > micromatch > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
warning @vue/cli-plugin-eslint > [email protected]: This loader has been deprecated. Please use eslint-webpack-plugin
warning @vue/cli-plugin-eslint > [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
warning @vue/cli-plugin-eslint > eslint > file-entry-cache > flat-cache > [email protected]: CircularJSON is in maintenance only, flatted is its successor.
warning @vue/cli-plugin-unit-jest > vue-jest > extract-from-css > css > [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
warning @vue/cli-plugin-unit-jest > vue-jest > extract-from-css > css > [email protected]: Please see https://github.com/lydell/urix#deprecated
warning @vue/cli-plugin-unit-jest > jest > jest-cli > jest-environment-jsdom > jsdom > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning @vue/cli-plugin-unit-jest > jest > jest-cli > jest-environment-jsdom > jsdom > [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
warning @vue/cli-plugin-unit-jest > jest > jest-cli > jest-haste-map > [email protected]: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
warning @vue/cli-plugin-unit-jest > jest > jest-cli > jest-haste-map > sane > [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning @vue/cli-plugin-unit-jest > jest > jest-cli > prompts > [email protected]: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
warning @vue/cli-plugin-unit-jest > jest > jest-cli > jest-environment-jsdom > jsdom > [email protected]: use String.prototype.padStart()
warning @vue/cli-plugin-unit-jest > jest > jest-cli > jest-runtime > babel-core > babel-register > [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning @vue/cli-service > [email protected]: See https://github.com/lydell/source-map-url#deprecated
warning @vue/cli-service > [email protected]: 3.x is no longer supported
warning @vue/cli-service > webpack-dev-server > [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
warning @vue/cli-service > webpack-dev-server > webpack-log > [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
warning @vue/cli-service > @intervolga/optimize-cssnano-plugin > cssnano-preset-default > postcss-svgo > [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
warning @vue/cli-service > @intervolga/optimize-cssnano-plugin > cssnano-preset-default > postcss-svgo > svgo > [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
warning [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
warning [email protected]: 3.x is no longer supported
warning node-sass > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning node-sass > node-gyp > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning node-sass > node-gyp > [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
warning [email protected]: This project has been renamed to 'tasksfile'. Install using 'npm install tasksfile' instead.
warning runjs > [email protected]: This project has been renamed to @pawelgalazka/cli . Install using @pawelgalazka/cli instead
warning runjs > microcli > [email protected]: This project has been renamed to @pawelgalazka/cli-args. Install using @pawelgalazka/cli-args instead
warning svg-sprite-loader > [email protected]: 3.x is no longer supported
warning [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
warning svgo > [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
[3/5] Fetching packages...
warning [email protected]: Invalid bin field for "url-loader".
[4/5] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0".
[5/5] Building fresh packages...
[-/5] ⢀ waiting...
[-/5] ⢀ waiting...
[3/5] ⢀ deasync
[-/5] ⢀ waiting...
error C:\Users\demo02\node_modules\node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: C:\Users\demo02\node_modules\node-sass
Output:
Building: C:\Program Files\nodejs\node.exe C:\Users\demo02\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 [
gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\\demo02\\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 verb cli ]
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 (C:\Users\demo02\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\demo02\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\demo02\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\demo02\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\demo02\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\demo02\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\demo02\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\demo02\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\demo02\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\demo02\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\demo02\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\demo02\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:202:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Python311\python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Python311\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (node:child_process:402:12)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at maybeClose (node:internal/child_process:1100:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\\demo02\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\demo02\node_modules\node-sass
gyp ERR! node -v v16.19.1

下载python

安装python

设置python环境变量

1)电脑右击——属性——高级系统设置—高级—环境变量

2)系统变量—Path 中添加环境变量 C:\Python27(python安装目录)
在这里插入图片描述

重新运行项目,大功告成

  • 今天就写到这里啦~
  • 小伙伴们,( ̄ω ̄( ̄ω ̄〃 ( ̄ω ̄〃)ゝ我们明天再见啦~~
  • 大家要天天开心哦

欢迎大家指出文章需要改正之处~
学无止境,合作共赢

在这里插入图片描述

欢迎路过的小哥哥小姐姐们提出更好的意见哇~~

猜你喜欢

转载自blog.csdn.net/tangdou369098655/article/details/132867981
今日推荐