nodejs / nodejs/node-gyp

yarn build: run scripts failed in package.json

Open
#3,154 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.7k
Forks
1.9k
Avg merge
1d 4h
Merged PRs (30d)
5

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Windows failure using the package.json scripts and the reported node-gyp configure/build commands. Compare the direct node-gyp invocation with the Yarn-launched command and inspect the referenced node-gyp log.js stack; done means the Yarn build path completes without the reported Logger error.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.