Skip to content

Commit

Permalink
fix(main/nodejs-{,-lts}: do not allow npm to upgrade itself
Browse files Browse the repository at this point in the history
  • Loading branch information
termux-pacman-bot committed Jan 17, 2023
1 parent 75551dc commit 80b32ba
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/nodejs-lts/build.sh
Expand Up @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Open Source, cross-platform JavaScript runtime environme
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="Yaksh Bariya <yakshbari4@gmail.com>"
TERMUX_PKG_VERSION=18.13.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://nodejs.org/dist/v${TERMUX_PKG_VERSION}/node-v${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=fd4ac562e01d172896e3a959bd59552dbf647331c90d726f8d3471683dd3da68
# Note that we do not use a shared libuv to avoid an issue with the Android
Expand Down
21 changes: 21 additions & 0 deletions packages/nodejs-lts/deps-npm-lib-commands-install.js.patch
@@ -0,0 +1,21 @@
--- ./deps/npm/lib/commands/install.js.orig 2023-01-17 18:37:18.553261550 +0530
+++ ./deps/npm/lib/commands/install.js 2023-01-17 18:44:48.711879839 +0530
@@ -118,6 +118,18 @@
throw e
}
}
+ try {
+ if (forced) {
+ log.warn(
+ 'install',
+ `Force installing npm version unpatched version of ${npmManifest.version}. This is very likely to break installation of global packages using npm. See https://github.com/termux/termux-packages/issues/13293`
+ )
+ } else {
+ throw new Error("Can't install npm globally as it will very likely break installation of global packages using npm. See https://github.com/termux/termux-packages/issues/13293")
+ }
+ } catch(e) {
+ throw e
+ }
}

// don't try to install the prefix into itself
1 change: 1 addition & 0 deletions packages/nodejs/build.sh
Expand Up @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Open Source, cross-platform JavaScript runtime environme
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="Yaksh Bariya <yakshbari4@gmail.com>"
TERMUX_PKG_VERSION=19.4.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://nodejs.org/dist/v${TERMUX_PKG_VERSION}/node-v${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=020541d670f528bd03ba0b92a1d0c46d6850982175a72f2aa557aefeda31b261
# Note that we do not use a shared libuv to avoid an issue with the Android
Expand Down
21 changes: 21 additions & 0 deletions packages/nodejs/deps-npm-lib-commands-install.js.patch
@@ -0,0 +1,21 @@
--- ./deps/npm/lib/commands/install.js.orig 2023-01-06 02:53:25.000000000 +0530
+++ ./deps/npm/lib/commands/install.js 2023-01-17 18:45:53.985551449 +0530
@@ -119,6 +119,18 @@
throw e
}
}
+ try {
+ if (forced) {
+ log.warn(
+ 'install',
+ `Force installing npm version unpatched version of ${npmManifest.version}. This is very likely to break installation of global packages using npm. See https://github.com/termux/termux-packages/issues/13293`
+ )
+ } else {
+ throw new Error("Can't install npm globally as it will very likely break installation of global packages using npm. See https://github.com/termux/termux-packages/issues/13293")
+ }
+ } catch(e) {
+ throw e
+ }
}

// don't try to install the prefix into itself

0 comments on commit 80b32ba

Please sign in to comment.