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

[Bug]: Bump nodejs to satisfy npm update req #17806

Closed
Leif-W opened this issue Sep 12, 2023 · 7 comments · Fixed by #19258
Closed

[Bug]: Bump nodejs to satisfy npm update req #17806

Leif-W opened this issue Sep 12, 2023 · 7 comments · Fixed by #19258
Labels
inactive No activity in a certiain period of time. nodejs Issue is about nodejs-related stuff, including npm. update package

Comments

@Leif-W
Copy link

Leif-W commented Sep 12, 2023

Problem description

[05:35:38] ~ -> npm -g i npm@10.1.0
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: npm@10.1.0
npm ERR! notsup Not compatible with your version of node/npm: npm@10.1.0
npm ERR! notsup Required: {"node":"^18.17.0 || >=20.5.0"}
npm ERR! notsup Actual: {"npm":"9.8.1","node":"v20.2.0"

What steps will reproduce the bug?

node v20.2.0 installed # current nodejs pkg
npm -g i npm@10.1.0 # current max
error, requires node >= v20.5.0

What is the expected behavior?

npm should be able to update itself when a supported node version is installed

System information

termix-info:

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=28021
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages.termux.dev/apt/termux-main stable main
# sources.list.d/pointless.list
deb https://its-pointless.github.io/files/24 termux extras
# root-repo (sources.list.d/root.list)
deb https://packages.termux.dev/apt/termux-root root stable
# x11-repo (sources.list.d/x11.list)
deb https://packages.termux.dev/apt/termux-x11 x11 main
# sources.list.d/rendiix.list
deb https://rendiix.github.io android-tools termux
Updatable packages:
All packages up to date
termux-tools version:
1.39.0
Android version:
13
Kernel build information:
Linux localhost 4.19.113-26203352 #1 SMP PREEMPT Tue Jul 25 17:42:44 KST 2023 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-N986U1
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.api versionCode:51
@Leif-W Leif-W added bug report Something is not working properly. untriaged labels Sep 12, 2023
@sylirre
Copy link
Member

sylirre commented Sep 12, 2023

Just FYI that NPM self-upgrade is not supported by Termux. There even patch was added to disable it: 6b05a8e. How you managed to bypass it that's another question.

@sylirre sylirre added the nodejs Issue is about nodejs-related stuff, including npm. label Sep 12, 2023
@Leif-W
Copy link
Author

Leif-W commented Sep 12, 2023

@sylirre That is old news, that was an old patch, resulting from an npm limitation that was fixed in May/June, and subsequently fixed in Termux around June/July-ish? So that point is a non-issue. The referenced patch is outdated and shouldn't even be applied anymore.

@licy183 licy183 added update package and removed untriaged bug report Something is not working properly. labels Sep 15, 2023
@sphost1
Copy link

sphost1 commented Oct 14, 2023

So it's not fixed yet I'm right?

@Leif-W
Copy link
Author

Leif-W commented Oct 14, 2023

So it's not fixed yet I'm right?

Patch 6b05a8e was only needed as a temporary solution. There was a problem upstream with npm that arose on the Arm/Android build, due to some old script they had, dependent upon some older code, or something. The bug arose sometime around November/December-ish 2022 IIRC, part of an npm dependency cacache, was recognized/patched as a workaround in Termux in January, and was fixed upstream npm in May-ish 2023, and a bit later in the LTS version. Termux npm was bumped in July-ish but there was the cruft patch that spewed an error message that was left behind which refused to do updates. See notes on issue #13293 and look up the npm and cacache Github Issues and patches for yourselves.

In short, I think the only bug is that we erroneously still think there's a bug, and the nodejs/deps-npm-lib-commands-install.js.patch file should be deleted, and nodejs and nodejs-lts need a bump. Maybe I am wrong? But try it and see before assuming the old bug still exists? This issue #17806 and #13293 could probably be closed if a bump and patch removal fixes the issue.

@Leif-W
Copy link
Author

Leif-W commented Nov 10, 2023

I'm attempting to build node 21.0.0 on device. (I know there's newer patch levels but I wanted to start at 21.0.0 as a test efore moving on). Most patches that failed to apply were straightforward to resolve. I hand edited each diff, noting lines and hunk sizes. A couple patches were no longer necessary due to upstream changes. I have notes on all patch file modifications citing specific files in upstream commits. Many patches applied unmodified, though I didn't check those yet to make sure they're correct and necessary.

I get to this point with gyp complaining about undefined android_ndk_path variable. I may have missed a step? Any hints?

In cloned repo termux-packages dir, running ./build-package.sh -I nodejs.

Applying patch: tools-v8_gypfiles-toolchain.gypi.patch
Applying patch: tools-v8_gypfiles-v8.gyp.patch
Node.js configure: Found Python 3.11.6...
gyp: Undefined variable android_ndk_path in /data/data/com.termux/files/home/.termux-build/nodejs/src/node.gyp while trying to load /data/data/com.termux/files/home/.termux-build/nodejs/src/node.gyp
Error running GYP

@stale stale bot added the inactive No activity in a certiain period of time. label Jan 25, 2024
@Leif-W
Copy link
Author

Leif-W commented Feb 21, 2024

The npm bug was fixed last year (about 9 months ago) as noted and referenced above, but the Termux patch to prevent npm self-update still exists.

@thunder-coding
Copy link
Member

@Leif-W that patch is going to stay, manual npm updates mess with our packaged npm files. When termux is updated, those new files which newer npm version might have created will not be removed by apt, this behaviour can be problematic in some cases. Also let's not forget that Android is not a supported platform and we are just hacking node and npm to somehow work in this weird environment, its better if things are tested.

And if you want npm updates faster, separating npm from nodejs package is on my todo list already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive No activity in a certiain period of time. nodejs Issue is about nodejs-related stuff, including npm. update package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants