Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Aug 2017 12:49:20 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 221762] www/node: undefined require('os').cpus() on aarch64
Message-ID:  <bug-221762-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D221762

            Bug ID: 221762
           Summary: www/node: undefined require('os').cpus() on aarch64
           Product: Ports & Packages
           Version: Latest
          Hardware: arm64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: bhughes@freebsd.org
          Reporter: gergely.czuczy@harmless.hu
          Assignee: bhughes@freebsd.org
             Flags: maintainer-feedback?(bhughes@freebsd.org)

Hello,

I've installed npm on an aarch64, -CURRENT, and whatever i'm trying to inst=
all,
i'm always getting the following:

root@aegir:~# npm install -g @angular/cli
npm ERR! Cannot read property 'length' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-08-23T19_50_05_510Z-debug.log
root@aegir:~# less /root/.npm/_logs/2017-08-23T19_50_05_510Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   '@angular/cli' ]
2 info using npm@5.3.0
3 info using node@v8.4.0
4 verbose npm-session 5c14726b0422cde1
5 verbose stack TypeError: Cannot read property 'length' of undefined
5 verbose stack     at Object.<anonymous>
(/usr/local/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js:5:61)
5 verbose stack     at Module._compile (module.js:573:30)
5 verbose stack     at Object.Module._extensions..js (module.js:584:10)
5 verbose stack     at Module.load (module.js:507:32)
5 verbose stack     at tryModuleLoad (module.js:470:12)
5 verbose stack     at Function.Module._load (module.js:462:3)
5 verbose stack     at Module.require (module.js:517:17)
5 verbose stack     at require (internal/module.js:11:18)
5 verbose stack     at Object.<anonymous>
(/usr/local/lib/node_modules/npm/node_modules/worker-farm/lib/index.js:3:14)
5 verbose stack     at Module._compile (module.js:573:30)
5 verbose stack     at Object.Module._extensions..js (module.js:584:10)
5 verbose stack     at Module.load (module.js:507:32)
5 verbose stack     at tryModuleLoad (module.js:470:12)
5 verbose stack     at Function.Module._load (module.js:462:3)
5 verbose stack     at Module.require (module.js:517:17)
5 verbose stack     at require (internal/module.js:11:18)
6 verbose cwd /root
7 verbose FreeBSD 12.0-CURRENT
8 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g"
"@angular/cli"
9 verbose node v8.4.0
10 verbose npm  v5.3.0
11 error Cannot read property 'length' of undefined
12 verbose exit [ 1, true ]

Apparently
/usr/local/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js:5 is t=
he
culprit:

const DEFAULT_OPTIONS =3D {
          maxCallsPerWorker           : Infinity
        , maxConcurrentWorkers        : require('os').cpus().length
        , maxConcurrentCallsPerWorker : 10
        , maxConcurrentCalls          : Infinity
        , maxCallTime                 : Infinity // exceed this and the who=
le
worker is terminated
        , maxRetries                  : Infinity
        , forcedKillTime              : 100
        , autoStart                   : false

Apparently that require('os').cpus().length is the problem, length is undef=
ined
here. Personally I've replaced it with a 4, as my cpucount is, however it's=
 not
a universal generic workaround.

After a suggestion from sunpoet@, the culprit appears to be node:

$ node
> require('os').cpus().length
TypeError: Cannot read property 'length' of undefined
    at repl:1:21
    at ContextifyScript.Script.runInThisContext (vm.js:44:33)
    at REPLServer.defaultEval (repl.js:239:29)
    at bound (domain.js:301:14)
    at REPLServer.runBound [as eval] (domain.js:314:12)
    at REPLServer.onLine (repl.js:440:10)
    at emitOne (events.js:120:20)
    at REPLServer.emit (events.js:210:7)
    at REPLServer.Interface._onLine (readline.js:279:10)
    at REPLServer.Interface._line (readline.js:626:8)
> require('os').cpus()
undefined
> aegir@aegir:~/aegir/aegir-ui$ uname -a
FreeBSD aegir 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r322723M: Tue Aug 22
19:13:29 CEST 2017=20=20=20=20
toor@marvin.harmless.hu:/tank/rpi3/crochet/work.aegir/obj/arm64.aarch64/tan=
k/rpi3/src/sys/AEGIR
 arm64

Could someone please look into it?

Thanks,
Gergely

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-221762-13>