Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

make error when run without access to `/proc`

オープン
#3,059 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
javascript, linux, node.js

調査の方向性

lib/build.js の176-179行目から始め、ProcSubset=pid を指定した提供済みの systemd-run コマンドを使って、CPUが0の場合の結果を再現します。結果として得られる make の引数を確認し、os.cpus() が空の配列を返したときに、ビルドがジョブ数0を渡さなくなっていることを検証します。

索引モデルが issue の本文から書いたものです。

説明

  • Node Version: node = v20.16.0, npm = 10.8.1
  • Platform: Linux 6.8.0-40-generic x86_64
  • Module: re2
Verbose output (from npm or node-gyp):
npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build', '--jobs', 0 ]
npm error make: the '-j' option requires a positive integer argument

When building a package using the systemd security option ProcSubset=pid, gyp sets the number of jobs to 0, which make does not accept.

I believe the relevant code is here: https://github.com/nodejs/node-gyp/blob/e6f4ede10cca28e9edeaa85d7830914c5d1499c7/lib/build.js#L176-L179

The documentation for Node function os.cpus() says:

Returns an array of objects containing information about each logical CPU core. The array will be empty if no CPU information is available, such as if the /proc file system is unavailable.

This can be shown by getting the number of CPUs in a transient service unit:

$ node -e "console.log(require('node:os').cpus().length)"
16

$ sudo systemd-run -p ProcSubset=pid -t -- \
  node -e "console.log(require('node:os').cpus().length)"
0

In the event of os.cpus() not returning any information, I suggest that gyp should either default to some constant number of parallel jobs or let make run as many jobs as it wants.

主要言語
Python
スター
10.7k
フォーク
1.9k
平均マージ
1日 4時間
マージ済み PR(30日)
5

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nodejs/node-gyp のほかの issue

nodejs/node-gyp の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。