javascript 错误“sh:节点-gyp-内部版本:未找到命令”

pvabu6sv  于 2023-01-19  发布在  Java
关注(0)|答案(3)|浏览(127)

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 v12.3.1( Monterey )
Node.js版本:16.14.2
npm版本:8.7.0

cx6n0qe3

cx6n0qe31#

运行yarn install,然后运行npm install,不知何故工作。
我不知道怎么做。

yeotifhr

yeotifhr2#

尝试使用此命令进行安装,如下所示:

npm install node-gyp
vktxenjb

vktxenjb3#

我无法在您的package.json文件中找到node-gyp模块。
尝试运行npm install node-gyp并按照node-gyp模块npm link的说明进行操作。

相关问题