Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

yarn build: run scripts failed in package.json

未关闭
#3,154 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
node.js
领域
build-system

调研方向

使用 package.json 脚本以及报告中的 node-gyp configure/build 命令重现 Windows 失败。比较直接调用 node-gyp 与由 Yarn 启动的命令,并检查所引用的 node-gyp log.js 堆栈;当 Yarn 构建路径在没有报告的 Logger 错误的情况下完成时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Steps

  1. npm install node-gyp -g
  2. yarn init
  3. create hello.cc, binding.gyp, index.js

package.json


  "scripts": {
    "build": "node-gyp configure && node-gyp build",
    "run:demo": "node index.js"
  },

run directly success


node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@11.2.0

but run from yarn failed


yarn build
yarn run v1.22.22
$ node-gyp configure && node-gyp build

E:\lab\node-gyp-demo>if not defined npm_config_node_gyp (node "C:\programs\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure )  else (node "" configure ) 
C:\programs\nodejs\node_modules\npm\node_modules\node-gyp\lib\log.js:80
    log.pause()
        ^

TypeError: Cannot read properties of undefined (reading 'pause')
    at new Logger (C:\programs\nodejs\node_modules\npm\node_modules\node-gyp\lib\log.js:80:9)
    at Object.<anonymous> (C:\programs\nodejs\node_modules\npm\node_modules\node-gyp\lib\log.js:164:11)
    at Module._compile (node:internal/modules/cjs/loader:1562:14)
    at Object..js (node:internal/modules/cjs/loader:1699:10)
    at Module.load (node:internal/modules/cjs/loader:1313:32)
    at Function._load (node:internal/modules/cjs/loader:1123:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1335:12)
    at require (node:internal/modules/helpers:136:16)

Node.js v22.13.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

主要语言
Python
星标
10.7k
派生
1.9k
平均合并
1 天 4 小时
30 天内合并 PR
5

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nodejs/node-gyp 的其他 Issue

查看 nodejs/node-gyp 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。