Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install commands fail on Android 8 - os.cpus() returns undefined #37

Open
XeroAlpha opened this issue Jan 11, 2019 · 3 comments
Open

Comments

@XeroAlpha
Copy link

See termux issues#1798

@XeroAlpha
Copy link
Author

目前有个临时的解决方案:root打开node,例如 sudo npm i ws

@imkiva
Copy link
Contributor

imkiva commented Jan 11, 2019

看到了,/proc/stat 不可读引起的权限问题。
从 Android P 开始,/proc 已经不可能被非系统 app 读取了。
也许有其他解决办法,把 api level 降低也许有用

@Aysnine
Copy link

Aysnine commented Nov 16, 2019

直接改 /data/data/io.neoterm/files/usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js,按你的手机 cpu 核心数写上去,亲测可用。

'use strict'

const DEFAULT_OPTIONS = {
          maxCallsPerWorker           : Infinity
        , maxConcurrentWorkers        : 8 // !!! here
        , maxConcurrentCallsPerWorker : 10
        , maxConcurrentCalls          : Infinity
        , maxCallTime                 : Infinity // exceed this and the whole worker is terminated
        , maxRetries                  : Infinity
        , forcedKillTime              : 100
        , autoStart                   : false
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants