Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

make error when run without access to `/proc`

Aperta
#3,059 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
javascript, linux, node.js

Direzione di ricerca

Inizia da lib/build.js alle righe 176-179 e riproduci il risultato con zero CPU usando il comando systemd-run fornito con ProcSubset=pid. Controlla gli argomenti make risultanti e verifica che una build non passi più un numero di job pari a zero quando os.cpus() restituisce un array vuoto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

  • 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.

Lingua principale
Python
Stelle
10.7k
Fork
1.9k
Merge medio
1g 4h
PR unite (30g)
5

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nodejs/node-gyp

Tutte le issue di nodejs/node-gyp

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.