纱线安装会引发错误:gyp动词`which`失败错误:找不到:python2

编程入门 行业动态 更新时间:2024-10-08 22:52:05

纱线安装会引发<a href=https://www.elefans.com/category/jswz/34/1771449.html style=错误:gyp动词`which`失败错误:找不到:python2"/>

纱线安装会引发错误:gyp动词`which`失败错误:找不到:python2

在一个React项目中,我试图运行“纱线安装”,但它抛出以下错误:

gyp动词which失败,错误:未找到:python2

完整错误回溯:

yarn install v1.22.4
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 unsynchroni
zed 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.
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 " > @coreui/[email protected]" has unmet peer dependency "perfect-scrollbar@^1.5.0".
warning " > @coreui/[email protected]" has unmet peer dependency "@popperjs/core@^2.0.6".
warning " > @coreui/[email protected]" has incorrect peer dependency "@coreui/coreui@^2.1.16".
warning " > @coreui/[email protected]" has unmet peer dependency "mutationobserver-shim@^0.3.3".
warning " > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=5".
warning " > [email protected]" has unmet peer dependency "classnames@^2.2.5".
warning " > [email protected]" has unmet peer dependency "prop-types@^15.0.0".
warning "react-scripts > @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...
[-/4] ⡀ waiting...
[3/4] ⡀ node-sass
error C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\node-sass
Output:
Binary found at C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\node-sass\vendor\win32-x64-72\binding.node
Testing binary
Binary has a problem: Error: Cannot find module './_baseClone'
Require stack:
- C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\lodash\cloneDeep.js
- C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\node-sass\lib\index.js
- C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\node-sass\scripts\build.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\lodash\cloneDeep.js:1:17)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Rahul\\yantra-front\\cargo_frontend\\cargo-app\\node_modules\\lodash\\cloneDeep.js',
    'C:\\Users\\Rahul\\yantra-front\\cargo_frontend\\cargo-app\\node_modules\\node-sass\\lib\\index.js',
    'C:\\Users\\Rahul\\yantra-front\\cargo_frontend\\cargo-app\\node_modules\\node-sass\\scripts\\build.js'
  ]
}
Building the binary locally
Building: C:\Program Files\nodejs\node.exe C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libs
ass_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:\\Users\\Rahul\\yantra-front\\cargo_frontend\\cargo-app\\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\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:167:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:167: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:\Users\Rahul\AppData\Local\Programs\Python\Python37\python.EXE
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\Rahul\AppData\Local\Programs\Python\Python37\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: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:303:12)
gyp ERR! stack     at ChildProcess.emit (events.js:310:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Rahul\\yantra-front\\cargo_frontend\\cargo-app\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cfl
ags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\Rahul\yantra-front\cargo_frontend\cargo-app\node_modules\node-sass
gyp ERR! node -v v12.16.3
gyp ERR! node-gyp -v v3.8.0

而我的路径中同时拥有python 3和2

C:\Python27;C:\Python27\Tools\Scripts
C:\Users\Rahul\.windows-build-tools\python27\
C:\Users\Rahul\AppData\Local\Programs\Python\Python37\
C:\Users\Rahul\AppData\Local\Programs\Python\Python37\Scripts\
C:\Users\Rahul\AppData\Roaming\npm
C:\Users\Rahul\AppData\Local\Yarn\bin
C:\Users\Rahul\AppData\Local\Microsoft\WindowsApps
%USERPROFILE%\AppData\Local\Microsoft\WindowsApps

我无法运行该项目。请帮助!

Package.json

{
  "name": "cargo-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@coreui/coreui": "^3.0.0",
    "@coreui/react": "^2.5.7",
    "@fortawesome/fontawesome-svg-core": "^1.2.28",
    "@fortawesome/free-solid-svg-icons": "^5.13.0",
    "@fortawesome/react-fontawesome": "^0.1.9",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "axios": "^0.19.2",
    "history": "^4.10.1",
    "node-sass": "^4.14.1",
    "react": "^16.13.1",
    "react-bootstrap-table-next": "^4.0.1",
    "react-dom": "^16.13.1",
    "react-redux": "^7.2.0",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.4.1",
    "react-toastify": "^6.0.0",
    "reactjs-localstorage": "^0.0.8",
    "reactstrap": "^8.4.1",
    "redux": "^4.0.5",
    "redux-thunk": "^2.3.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
回答如下:

此节点依赖性was毕竟能够找到您的Python。但是,它显然依赖于Python 2。

[您会看到它说print "%s.%s.%s",这是Python 2语法,在Python 3中无效。

更多推荐

纱线安装会引发错误:gyp动词`which`失败错误:找不到:python2

本文发布于:2024-05-07 14:06:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1756599.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   找不到   动词   纱线   gyp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!