repo icon indicating copy to clipboard operation
repo copied to clipboard

Issues with Node

Open zaptrem opened this issue 5 years ago • 22 comments

I installed NodeJS off of apt.bingner.com (though I think they mirrored this repo) and got an error related to an unsigned lib node.dyld. I solved it by symlinking to where the program seemed to expect it to be (Users/Sam/...).

However, many system calls seem to be broken. For example, running yarn add global code-server results in ENOENT: function not implemented copyfile (very long path). Calling fs.copyFile results in Bad system call: 12. For example, running npm install -g expo-cli results in Error: spawn EPERM (see link: https://imgur.com/a/1mAqcp2). As a result, no major program I’ve tried has worked.

Is this related to a messed up build? Would a new version fix these issues?

Thanks

Edit: node ver 12.3.1-3

zaptrem avatar May 25 '20 22:05 zaptrem

Could you SSH and provide a detailed log (verbose output would be appreciated)? This repo is just a playground for myself (see qemu for example).

Codesigning is a PIA sometimes, but you shouldn't need the symlink (remove it); dyld should pick the correct dylib, but even Sam knows about that issue.

EPERM comes from iOS refusing to execute shebangs in scripts, but ENOENT is sort of interesting. I wouldn't personally expect a fix pushed anytime soon (I haven't DM bingner for like 4 months), I made promises to look into stuff and got really busy since 2020 threw plans out the window.

MCApollo avatar May 26 '20 07:05 MCApollo

Why doesn’t iOS execute shebangs? I’ll grab that log but which verbose options do you want enabled? I remember enabling a few but they added very little.

Without the symlink dyld finds the right lib but complains that it’s signed incorrectly.

On Tue, May 26, 2020 at 3:39 AM Mac [email protected] wrote:

Could you SSH and provide a detailed log (verbose output would be appreciated)? This repo is just a playground for myself (see qemu for example).

Codesigning is a PIA sometimes, but you shouldn't need the symlink (remove it); dyld should pick the correct dylib, but even Sam knows about that issue.

EPERM comes from iOS refusing to execute shebangs in scripts, but ENOENT is sort of interesting. I wouldn't personally expect a fix pushed anytime soon (I haven't DM bingner for like 4 months), I made promises to look into stuff and got really busy since 2020 threw plans out the window.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MCApollo/repo/issues/1#issuecomment-633862906, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMJTRUUWBOZJJBC3ZIWNUDRTNW4JANCNFSM4NJ2JWSA .

zaptrem avatar May 26 '20 07:05 zaptrem

I personally don't use npm/node often (just ported it for clout and interest), so just use your best judgement and upload to a gist.

Mind me asking what iOS version and device you're using? Try to reinstall nodejs because it's confusing where that codesigning bug comes from.

iOS will refuse to execute scripts when using something like exec as part of codesigning since (iirc) iOS 10/11.

MCApollo avatar May 26 '20 23:05 MCApollo

fs.copyFile problem: https://pastebin.com/G1Ex4YrZ Ran “sudo npm install -g code-server —unsafe-perm”

I reinstalled multiple times with the version on bingner and your Test repo, the signing error remained until I created that symlink. I’m on iOS 13.5 + 3rd gen iPad Pro using Unc0ver.

Re exec: I thought jailbreaking disabled codesigning checks? Is there a patch to fix these scripts somewhere? Sorry, I’m a inexperienced in the jailbreaking world.

zaptrem avatar May 27 '20 02:05 zaptrem

Okay, funny enough I've talked to TheNoim before (I won't link the issue he posted because it'll ping everyone) but the system call was fixed in the issue he made.

https://github.com/JaneaSystems/nodejs-mobile/blob/5b286e16a5bc88ac9f84d8a0910b9b8eefb18042/deps/uv/src/unix/fs.c#L775

The only issue is I don't get EPERM when installing expo-cli, could you post a log of that also?

MCApollo avatar May 27 '20 05:05 MCApollo

Could you post a link-shortened version of that issue to avoid pinging? It would probably be useful for future people as well.

Will this fix be added into a future build on apt.bingner or mcapollo.github.io? Or is there some way I can patch my install with this?

The expo-cli install seems to succeed, but the error is half way through the install log. I haven’t tested expo-cli enough to know whether the error breaks the install. See this screenshot: https://imgur.com/a/jc6mIwd .

Also, is JIT enabled on this build? I think I saw you discussing how you made progress on it in a Reddit thread a while back.

zaptrem avatar May 27 '20 05:05 zaptrem

Also, here’s a screenshot of the signing error on a fresh install (before I create the symlink): https://imgur.com/a/6OVpBPt

zaptrem avatar May 27 '20 23:05 zaptrem

Fix is live now at - https://test.apt.bingner.com/ (Download ngttp/c-ares) and then remove the test repo when done

Could you tell me if this works?

MCApollo avatar May 28 '20 11:05 MCApollo

I downloaded the latest Node build and libc-ares2 from test.apt.bingner. The error with expo-cli remained. The installation error disappeared from the code-server installation but was replaced with another error with node-gyp:

https://imgur.com/a/Isry5hg

Though the code-server installation completes, the app is almost completely non-functional once started. We’re getting closer! May I ask what changed in this build (apart from the Node version bump?)

I apologize for all of the screenshot errors. Neither NewTerm nor MobileTerminal seem to have the ability to copy and paste.

zaptrem avatar May 28 '20 18:05 zaptrem

I have tried to download the latest version of Node 12.7.0-1 both on my iPhone 11 Pro and on the iPad Pro (2020) but I cannot install them correctly. On my iPhone I get the DPKG_LOCKED error, while on my iPad I get this error https://imgur.com/MyovhZt. I hope you can find this information useful.

Fede-z8na avatar May 30 '20 01:05 Fede-z8na

Had this error when trying to install Node from the test repo: PNG image

nVitius avatar May 30 '20 06:05 nVitius

@nVitius please refer to my previous comments on this issue, which included the solution: create a symlink from the place the library actually is to the long path it mentions in the error (/Users/Sam/etc...)

@Fede-z8na Did you install the version from test.apt.bingner?

zaptrem avatar May 30 '20 06:05 zaptrem

@zaptrem Could you run the command with the exit code 126? What's the shebang on that script? I would install code-server myself, but nodejs being nodejs nears 1G in dependencies installing it (I got another device to use, but I would have to update it with a macos/win VM). Seems the last issue would be nodejs having trouble running scripts

I got a maintainer email listed and don't know why people are using the testing repo

MCApollo avatar May 30 '20 06:05 MCApollo

@nVitius Sorry if I came off as rude, I didn’t see your first deleted comment and you had the same issue as @zaptrem. Seem like you had the testing repo installed before-hand (there’s been some updates there that have broken jailbreaks before), sorry for the misunderstanding. Did you find any workarounds by any chance?

This is a ping message, could anyone seeing this could provide more debug/verbose messages? I’ll try to invest more time why dpkg dislikes updating hopefully this week.

More logs from any package manager but Cydia, would be great, thanks!

MCApollo avatar Jun 10 '20 17:06 MCApollo

Here’s a screenshot of the error with sudo npm install -g expo-cli

IMG_0754

zaptrem avatar Jun 12 '20 21:06 zaptrem

I'm having the error on installing fsevents 73E0D466-2EC2-483C-8A8C-C710E0DDE5DB

nVitius avatar Jun 22 '20 16:06 nVitius

Also having a node-gyp issue, but that's unrelated. Going to ask them about that one.

Actually, I just noticed fs-events is an OSX-specific package. I'm not sure what in my dependency tree was installing it, but it seems like most packages are detecting iOS as an OSX environment.

EDIT - Turns out the fsevents issue was due to an optional dependency on a library called choked ar. Was solved with running npm i --no-optional. Also having the EPRM issue with deasync. The relevant call can be seen here: https://github.com/abbr/deasync/blob/master/build.js#L76

nVitius avatar Jun 22 '20 16:06 nVitius

@MCApollo (or anyone that can assist on this)

I've created a minimum repro for the EPERM bug that does the spawn call. Repo Here

  1. Clone the repo.
  2. Run node index.js
  3. Watch it fail.

Here are the logs from my run with NODE_DEBUG=cluster,fs,tls,module,timers running on an iPad:

iPad-4:/var/mobile/Projects/ios-node-child-process-bug-repro root# node index.js
MODULE 5041: looking for "/private/var/mobile/Projects/ios-node-child-process-bug-repro/index.js" in ["/var/root/.node_modules","/var/root/.node_libraries","/usr/lib/node"]
MODULE 5041: load "/private/var/mobile/Projects/ios-node-child-process-bug-repro/index.js" for module "."
MODULE 5041: Module._load REQUEST child_process parent: .
MODULE 5041: load native module child_process
internal/child_process.js:407
    throw errnoException(err, 'spawn');
    ^

Error: spawn EPERM
    at ChildProcess.spawn (internal/child_process.js:407:11)
    at Object.spawn (child_process.js:548:9)
    at Object.<anonymous> (/private/var/mobile/Projects/testy/ios-node-child-process-bug-repro/index.js:3:19)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  errno: 'EPERM',
  code: 'EPERM',
  syscall: 'spawn'
}

I could only make it happen whenever I am trying to spawn a child process with the NPM binary. Calls to native binaries such as ls, echo, etc. seem to work fine. The problem arises from the fact that a lot of npm packages seem to call spawn with npm scripts - and it breaks.

Let me know if you want me to run it with any specific arguments or more debug options.

Edit: Running the repro on a OSX machine works fine - errors out on Windows the same way (which is expected since the command arguments need to be parsed/sanitized).

nascob avatar Jun 23 '20 08:06 nascob

As of now, the dpkg install issue is figured out to be a issue of the perl packager- dm.pl- that is still used to support lzma on older targets.

And as the EPERM issue, I know what code to change, but bingner wants to straight out patch EPERM issues on all supported jailbreaks.

MCApollo avatar Jun 23 '20 14:06 MCApollo

Out of interest - is the EPREM error a jailbreak issue, node issue or an ios specific issue? Can you provide any rough details?

nascob avatar Jun 24 '20 01:06 nascob

Also curious as to the nature of the issue. Can you provide specific details?

nVitius avatar Jun 27 '20 01:06 nVitius

Any fix for this discovered yet?

jenyaftw avatar Jun 30 '21 09:06 jenyaftw