【问题标题】:can't npm install the project无法 npm 安装项目
【发布时间】:2021-12-15 03:44:03
【问题描述】:

我有这个项目,我尝试 npm i

这是我的 package.json

 {
  "name": "gogo-react",
  "version": "4.2.3",
  "description": "Gogo - React Bootstrap 4 Admin Dashboard Template",
  "private": true,
  "dependencies": {
    "@glidejs/glide": "^3.3.0",
    "availity-reactstrap-validation": "^2.0.4",
    "axios": "^0.18.0",
    "chart.js": "^2.7.2",
    "classnames": "2.2.6",
    "firebase": "^5.9.4",
    "formik": "^1.5.1",
    "moment": "2.22.2",
    "mousetrap": "^1.6.3",
    "rc-slider": "^8.6.1",
    "rc-switch": "^1.6.0",
    "react": "^16.9.0",
    "react-albus": "^2.0.0",
    "react-autosuggest": "^9.3.4",
    "react-big-calendar": "^0.22.0",
    "react-chartjs-2": "^2.7.4",
    "react-circular-progressbar": "^2.0.2",
    "react-contextmenu": "^2.9.4",
    "react-datepicker": "^1.5.0",
    "react-dom": "^16.8.6",
    "react-dropzone-component": "^3.2.0",
    "react-google-maps": "^9.4.5",
    "react-image-lightbox": "^5.1.0",
    "react-intl": "2.4.0",
    "react-lines-ellipsis": "^0.14.1",
    "react-perfect-scrollbar": "^1.1.1",
    "react-quill": "^1.3.1",
    "react-rater": "^5.0.3",
    "react-redux": "^7.1.0",
    "react-router-dom": "^5.0.1",
    "react-scripts": "^3.0.1",
    "react-select": "^2.0.0-beta.7",
    "react-sortablejs": "^1.3.6",
    "react-table": "^6.10.0",
    "react-tagsinput": "^3.19.0",
    "react-transition-group": "^4.2.2",
    "react-yandex-maps": "^3.0.2",
    "reactstrap": "^8.0.1",
    "redux": "^4.0.1",
    "redux-saga": "^1.0.2",
    "sortablejs": "^1.6.1",
    "video.js": "^7.6.0",
    "yup": "^0.27.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "devDependencies": {
    "node-sass": "^4.12.0"
  }
}

这是我在 cmd 中得到的错误日志

npm ERR! code 1
npm ERR! path E:\digital-zone\react hotel app\Gogo-React-Admin-Dashboard-4.2.3\Source\Gogo-React\node_modules\grpc
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build --library=static_library
npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\20111\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=E:\digital-zone\react hotel app\Gogo-React-Admin-Dashboard-4.2.3\Source\Gogo-React\node_modules\grpc\src\node\extension_binary\node-v102-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=E:\digital-zone\react hotel app\Gogo-React-Admin-Dashboard-4.2.3\Source\Gogo-React\node_modules\grpc\src\node\extension_binary\node-v102-win32-x64-unknown --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v102' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@0.12.0
npm ERR! node-pre-gyp info using node@17.0.1 | win32 | x64
npm ERR! node-pre-gyp WARN Using request for node-pre-gyp https download
npm ERR! node-pre-gyp info check checked for "E:\digital-zone\react hotel app\Gogo-React-Admin-Dashboard-4.2.3\Source\Gogo-React\node_modules\grpc\src\node\extension_binary\node-v102-win32-x64-unknown\grpc_node.node" (not found)
npm ERR! node-pre-gyp http GET https://node-precompiled-binaries.grpc.io/grpc/v1.20.0/node-v102-win32-x64-unknown.tar.gz
npm ERR! node-pre-gyp http 404 https://node-precompiled-binaries.grpc.io/grpc/v1.20.0/node-v102-win32-x64-unknown.tar.gz
npm ERR! node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.20.0/node-v102-win32-x64-unknown.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not found for grpc@1.20.0 and node@17.0.1 (node-v102 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp http 404 status code downloading tarball https://node-precompiled-binaries.grpc.io/grpc/v1.20.0/node-v102-win32-x64-unknown.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.3.0
npm ERR! gyp info using node@17.0.1 | win32 | x64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.3.0
npm ERR! gyp info using node@17.0.1 | win32 | x64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if Python is C:\Users\20111\AppData\Local\Programs\Python\Python39\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\20111\AppData\Local\Programs\Python\Python39\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python39\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\20111\AppData\Local\Programs\Python\Python39-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\20111\AppData\Local\Programs\Python\Python39-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python39-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python39-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\20111\AppData\Local\Programs\Python\Python38\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\20111\AppData\Local\Programs\Python\Python38\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python38\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\20111\AppData\Local\Programs\Python\Python38-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\20111\AppData\Local\Programs\Python\Python38-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python38-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python38-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\20111\AppData\Local\Programs\Python\Python37\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\20111\AppData\Local\Programs\Python\Python37\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python37\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python37\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\20111\AppData\Local\Programs\Python\Python37-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\20111\AppData\Local\Programs\Python\Python37-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python37-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python37-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python37-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python37-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\20111\AppData\Local\Programs\Python\Python36\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\20111\AppData\Local\Programs\Python\Python36\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python36\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python36\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Users\20111\AppData\Local\Programs\Python\Python36-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Users\20111\AppData\Local\Programs\Python\Python36-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files\Python36-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files\Python36-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python36-32\python.exe
npm ERR! gyp ERR! find Python - "C:\Program Files (x86)\Python36-32\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if the py launcher can be used to find Python 3
npm ERR! gyp ERR! find Python - "py.exe" is not in PATH or produced an error
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python   npm config set python "C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack     at PythonFinder.fail (C:\Users\20111\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:330:47)
npm ERR! gyp ERR! stack     at PythonFinder.runChecks (C:\Users\20111\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:159:21)
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\20111\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:228:18)
npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (C:\Users\20111\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-python.js:294:16)
npm ERR! gyp ERR! stack     at exithandler (node:child_process:404:5)
npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:416:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:475:16)
npm ERR! gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\20111\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=E:\\digital-zone\\react hotel app\\Gogo-React-Admin-Dashboard-4.2.3\\Source\\Gogo-React\\node_modules\\grpc\\src\\node\\extension_binary\\node-v102-win32-x64-unknown\\grpc_node.node" "--module_name=grpc_node" "--module_path=E:\\digital-zone\\react hotel app\\Gogo-React-Admin-Dashboard-4.2.3\\Source\\Gogo-React\\node_modules\\grpc\\src\\node\\extension_binary\\node-v102-win32-x64-unknown" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v102"
npm ERR! gyp ERR! cwd E:\digital-zone\react hotel app\Gogo-React-Admin-Dashboard-4.2.3\Source\Gogo-React\node_modules\grpc
npm ERR! gyp ERR! node -v v17.0.1
npm ERR! gyp ERR! node-gyp -v v8.3.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\20111\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --library=static_library --module=E:\digital-zone\react hotel app\Gogo-React-Admin-Dashboard-4.2.3\Source\Gogo-React\node_modules\grpc\src\node\extension_binary\node-v102-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=E:\digital-zone\react hotel app\Gogo-React-Admin-Dashboard-4.2.3\Source\Gogo-React\node_modules\grpc\src\node\extension_binary\node-v102-win32-x64-unknown --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v102' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (E:\digital-zone\react hotel app\Gogo-React-Admin-Dashboard-4.2.3\Source\Gogo-React\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1062:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19043
npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "E:\\digital-zone\\react hotel app\\Gogo-React-Admin-Dashboard-4.2.3\\Source\\Gogo-React\\node_modules\\grpc\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
npm ERR! node-pre-gyp ERR! cwd E:\digital-zone\react hotel app\Gogo-React-Admin-Dashboard-4.2.3\Source\Gogo-React\node_modules\grpc
npm ERR! node-pre-gyp ERR! node -v v17.0.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.12.0
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\20111\AppData\Local\npm-cache\_logs\2021-10-30T11_58_00_082Z-debug.log

我的节点 -v 是 v17.0.1 npm -v 是 8.1.1
请注意,该项目已成功安装在具有旧版本 node.js 的另一台笔记本电脑上 如果您需要任何其他代码,请告诉我谢谢

【问题讨论】:

  • 错误:找不到任何要使用的 Python 安装。我猜你需要在你的电脑上安装 python

标签: node.js reactjs npm redux


【解决方案1】:

尝试卸载你当前的nodeJs。然后重新安装LTS版本的node。

【讨论】:

  • 我试过了,同样的问题已经发生
  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
【解决方案2】:

参考this 答案。您收到的错误提到无法找到 Python。上述链接答案中的步骤描述了如何通过删除并重新安装 node_modules 来解决此问题。

【讨论】:

    猜你喜欢
    • 2021-01-21
    • 2020-09-17
    • 1970-01-01
    • 2023-01-01
    • 1970-01-01
    • 2018-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多