reactjs sh:节点-gyp-构建:未找到命令

b0zn9rqh  于 2023-01-12  发布在  React
关注(0)|答案(1)|浏览(114)
    • bounty将在6天后过期**。此问题的答案可获得+50声望奖励。Pierre-olivier Gendraud正在寻找此问题的更详细答案:我试过yarn/npm install这个解决方案,但是它对我不起作用,而且它没有解释问题的根源

npm install失败并显示以下消息。我尝试删除node_modules并重新安装,但没有成功。
15104错误命令sh-c节点-gyp-build
15105错误sh:节点-gyp-构建:未找到命令
有人知道怎么解决吗?
npm install --verbose的错误日志:

npm ERR! code 127
npm ERR! path /Users/johnnycheng/Documents/React Projects/blockchain:fintech/coin-web-test2/node_modules/utf-8-validate
npm ERR! command failed
npm ERR! command sh -c node-gyp-build
npm ERR! sh: node-gyp-build: command not found
npm verb exit 127
npm timing npm Completed in 30755ms
npm verb unfinished npm timer reify 1650620386080
npm verb unfinished npm timer reify:build 1650620407577
npm verb unfinished npm timer build 1650620407582
npm verb unfinished npm timer build:deps 1650620407583
npm verb unfinished npm timer build:run:install 1650620407669
npm verb unfinished npm timer build:run:install:node_modules/bufferutil 1650620407670
npm verb unfinished npm timer build:run:install:node_modules/utf-8-validate 1650620407692
npm verb code 127

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/johnnycheng/.npm/_logs/2022-04-22T09_39_45_773Z-debug-0.log

我的项目的package.json:

{
  "name": "coin-web-test2",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.9.0",
    "@emotion/styled": "^11.8.1",
    "@fontsource/roboto": "^4.5.5",
    "@mui/material": "^5.6.2",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^13.0.0",
    "@testing-library/user-event": "^13.2.1",
    "crypto-js": "^3.1.9-1",
    "ethers": "^5.6.4",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-router-dom": "^6.3.0",
    "react-scripts": "4.0.3",
    "web-vitals": "^2.1.0",
    "web3": "^1.7.3"
  },
  "scripts": {
    "start": "NODE_ENV=production node_modules/react-scripts/bin/react-scripts.js start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

在此处查看完整的错误日志:Full error log
环境:macOS 12.3.1 Monterey
节点版本:版本16.14.2
npm版本:8.7.0

qnakjoqk

qnakjoqk1#

运行yarn install然后npm install不知何故工作。
不知道怎么回事。如果有人能解释一下就好了

相关问题