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 ERR! Cannot read property 'length' of undefined #2737

Closed
joshuambg opened this issue Aug 15, 2018 · 6 comments
Closed

NPM ERR! Cannot read property 'length' of undefined #2737

joshuambg opened this issue Aug 15, 2018 · 6 comments
Labels
bug report Something is not working properly help wanted Help is wanted in order to solve the issue

Comments

@joshuambg
Copy link

joshuambg commented Aug 15, 2018

npm/npm#19265
npm/npm#1855

This disruptive bug is still not elegantly fixed. Can we get a reliable fix from standard install please?

Unpacking nodejs-current (9.11.1) ...
Processing triggers for man (1.14.4) ...
Setting up nodejs-current (9.11.1) ...
$ node -v
v9.11.1
$ npm -v
5.6.0
@laem
Copy link
Contributor

laem commented Aug 15, 2018

Would it be resolved by updating nodejs-current to v10 #2621 ?

@F0RIS
Copy link

F0RIS commented Aug 15, 2018

I have same error :/

@MaxPelly
Copy link

replace $cpu with number of cores (or 1 if unsure)

sed -i "s|require('os').cpus().length|$cpu|g" /data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js

@fornwall fornwall added bug report Something is not working properly help wanted Help is wanted in order to solve the issue labels Aug 27, 2018
@fornwall
Copy link
Member

See #1798

@hltdev8642
Copy link

It should be noted that it may have to do with it being the beta version of termux because I couldn't get this fixed to work but as soon as I downgraded to the non beta version of termux and applied this fix it worked right away

@ctp-placebo
Copy link

ctp-placebo commented Jan 3, 2019

replace $cpu with number of cores (or 1 if unsure)

sed -i "s|require('os').cpus().length|$cpu|g" /data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js

Can someone clarify? I have seen this 7 ways on seven sites/threads.
What i have in the un-edited file:
, maxConcurrentWorkers : (require('os').cpus() || { length: 1 }).length

I have tried changing it to a hard-coded 1, 4, and 8 (8 core phone) and deleting the rest of the line.
I have tried changing the { length: 1 } to { length: 8 } and to 4, and even tried reversing the order of the statement so the OR above evals first (long-shot).
I tried apt install yarn and then yarn add npm. Nothing makes npm work.

Using
nodejs 11.6.0
npm 6.5.0
Android 9 (OxygenOS 9.0.2)
Termux & apt fully updated system.

Is there a solution to this?!

@ghost ghost locked and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug report Something is not working properly help wanted Help is wanted in order to solve the issue
Projects
None yet
Development

No branches or pull requests

7 participants