sh:node-gyp-build:未找到命令”

发布于 2025-01-23 14:22:09 字数 3097 浏览 4 评论 0原文

NPM安装在以下消息中失败。我尝试删除 node_modules 文件夹并再次安装,但它不起作用:

15104错误命令SH -C节点gyp-build

15105错误sh:节点gyp-build:找不到命令

我该如何解决?

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"
    ]
  }
}

在此处查看完整错误日志:完整错误log log

环境: macos  v12.3.1 (monterey)

node.js 版本:16.14.2

NPM版本:8.7.0

npm install is failing with the below message. I tried deleting the node_modules folder and installing it again, but it didn't work:

15104 error command sh -c node-gyp-build

15105 error sh: node-gyp-build: command not found

How can I solve this?

Error log of 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

File package.json of my project:

{
  "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"
    ]
  }
}

Check the full error log here: Full error log

Environment: macOS v12.3.1 (Monterey)

Node.js version: 16.14.2

npm version: 8.7.0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

一场春暖 2025-01-30 14:22:09

尝试使用此命令安装如下:

npm install node-gyp

Try installing using this command as follows:

npm install node-gyp
浪菊怪哟 2025-01-30 14:22:09

在我的Dockerfile中添加了一个全局安装节点GYP:

FROM node:18-alpine
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev yarn
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}

RUN npm install -g node-gyp

使我能够在node-18:Alpine上为Strapi 4.14.4设置运行Docker设置:

希望对当前搜索此随机AF问题的其他任何人有帮助。

Added a global install of node-gyp to my Dockerfile:

FROM node:18-alpine
# Installing libvips-dev for sharp Compatibility
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev yarn
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}

RUN npm install -g node-gyp

Enabled me to run docker setup for a Strapi 4.14.4 setup on node-18:alpine

Hopefully helpful to anyone else currently Googling this random AF issue.

凉墨 2025-01-30 14:22:09

运行纱线安装,然后npm安装以某种方式工作。

我不知道怎么样。

Running yarn install and then npm install somehow works.

I don't any idea how.

妄司 2025-01-30 14:22:09

我在您的 package.json 文件中找不到node-gyp模块。
尝试运行npm安装节点gyp,并按照 node-gyp module的说明 npm链接

I can't find node-gyp module in your package.json file.
Try running npm install node-gyp and following the instructions for node-gyp module npm link.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文