fix: remove old Node.js before installing v22 on Linux runner
The Act runner has Node 18 at /usr/local/bin/node which takes precedence over the apt-installed /usr/bin/node. Even after running nodesource setup and apt-get install, the old Node 18 binary remained in the PATH. Now removes old binaries and uses hash -r to force path re-lookup. Also removes package-lock.json before npm install to ensure correct platform-specific bindings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -25,9 +25,11 @@ jobs:
|
|||||||
NEED_INSTALL=false
|
NEED_INSTALL=false
|
||||||
if command -v node >/dev/null 2>&1; then
|
if command -v node >/dev/null 2>&1; then
|
||||||
NODE_MAJOR=$(node --version | sed 's/v\([0-9]*\).*/\1/')
|
NODE_MAJOR=$(node --version | sed 's/v\([0-9]*\).*/\1/')
|
||||||
echo "Found Node.js $(node --version) (major: ${NODE_MAJOR})"
|
echo "Found Node.js $(node --version) at $(which node) (major: ${NODE_MAJOR})"
|
||||||
if [ "$NODE_MAJOR" -lt 22 ]; then
|
if [ "$NODE_MAJOR" -lt 22 ]; then
|
||||||
echo "Node.js ${NODE_MAJOR} is too old, upgrading to 22..."
|
echo "Node.js ${NODE_MAJOR} is too old, removing before installing 22..."
|
||||||
|
sudo rm -f /usr/local/bin/node /usr/local/bin/npm /usr/local/bin/npx /usr/local/bin/corepack
|
||||||
|
hash -r
|
||||||
NEED_INSTALL=true
|
NEED_INSTALL=true
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@@ -37,7 +39,9 @@ jobs:
|
|||||||
if [ "$NEED_INSTALL" = true ]; then
|
if [ "$NEED_INSTALL" = true ]; then
|
||||||
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
|
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
|
||||||
sudo apt-get install -y nodejs
|
sudo apt-get install -y nodejs
|
||||||
|
hash -r
|
||||||
fi
|
fi
|
||||||
|
echo "Node.js at: $(which node)"
|
||||||
node --version
|
node --version
|
||||||
npm --version
|
npm --version
|
||||||
|
|
||||||
@@ -97,7 +101,7 @@ jobs:
|
|||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
working-directory: ./app
|
working-directory: ./app
|
||||||
run: |
|
run: |
|
||||||
rm -rf node_modules
|
rm -rf node_modules package-lock.json
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
- name: Install Tauri CLI
|
- name: Install Tauri CLI
|
||||||
|
|||||||
Reference in New Issue
Block a user