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

Issues with Node #1

Open
zaptrem opened this issue May 25, 2020 · 22 comments
Open

Issues with Node #1

zaptrem opened this issue May 25, 2020 · 22 comments

Comments

@zaptrem
Copy link

zaptrem commented May 25, 2020

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

@MCApollo
Copy link
Owner

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.

@zaptrem
Copy link
Author

zaptrem commented May 26, 2020 via email

@MCApollo
Copy link
Owner

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.

@zaptrem
Copy link
Author

zaptrem commented May 27, 2020

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.

@MCApollo
Copy link
Owner

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?

@zaptrem
Copy link
Author

zaptrem commented May 27, 2020

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
Copy link
Author

zaptrem commented May 27, 2020

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

@MCApollo
Copy link
Owner

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?

@zaptrem
Copy link
Author

zaptrem commented May 28, 2020

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.

@Fede-z8na
Copy link

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.

@nVitius
Copy link

nVitius commented May 30, 2020

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

@zaptrem
Copy link
Author

zaptrem commented May 30, 2020

@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?

@MCApollo
Copy link
Owner

@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
Copy link
Owner

MCApollo commented Jun 10, 2020

@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!

@zaptrem
Copy link
Author

zaptrem commented Jun 12, 2020

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

IMG_0754

@nVitius
Copy link

nVitius commented Jun 22, 2020

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

@nVitius
Copy link

nVitius commented Jun 22, 2020

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

@nascob
Copy link

nascob commented Jun 23, 2020

@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).

@MCApollo
Copy link
Owner

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.

@nascob
Copy link

nascob commented Jun 24, 2020

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

@nVitius
Copy link

nVitius commented Jun 27, 2020

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

@jenyaftw
Copy link

Any fix for this discovered yet?

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

6 participants