Skip to content

Upgrade modules

Upgrade modules #1

name: Debug nvu installation structure
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
debug-nvu-installation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install nvu
run: |
npm install -g node-version-use
- name: Install Node 24 with nvu
run: |
nvu install 24
- name: Debug installation structure
run: |
echo "Creating debug script..."
cat > debug-installation.cjs << 'EOF'
const fs = require('fs');
const path = require('path');
function debugNvuInstallation(installPath) {
console.log(`\n=== Debugging nvu installation in ${installPath} ===`);
// Check for node executable
const nodePath = path.join(installPath, 'bin', 'node');
console.log(`Checking node executable: ${nodePath}`);
console.log(` Exists: ${fs.existsSync(nodePath)}`);
// Check for npm directory
const npmPath = path.join(installPath, 'lib', 'node_modules', 'npm');
console.log(`\nChecking npm directory: ${npmPath}`);
console.log(` Exists: ${fs.existsSync(npmPath)}`);
if (fs.existsSync(npmPath)) {
// Check for npm package.json
const npmPackageJsonPath = path.join(npmPath, 'package.json');
console.log(`\nChecking npm package.json: ${npmPackageJsonPath}`);
console.log(` Exists: ${fs.existsSync(npmPackageJsonPath)}`);
// Check the problematic directory structure
const tufjsPath = path.join(npmPath, 'node_modules', '@tufjs');
console.log(`\nChecking @tufjs directory: ${tufjsPath}`);
console.log(` Exists: ${fs.existsSync(tufjsPath)}`);
if (fs.existsSync(tufjsPath)) {
const tufjsContents = fs.readdirSync(tufjsPath);
console.log(` Contents: [${tufjsContents.join(', ')}]`);
const modelsPath = path.join(tufjsPath, 'models');
console.log(`\nChecking @tufjs/models directory: ${modelsPath}`);
console.log(` Exists: ${fs.existsSync(modelsPath)}`);
if (fs.existsSync(modelsPath)) {
const modelsContents = fs.readdirSync(modelsPath);
console.log(` Contents: [${modelsContents.join(', ')}]`);
const modelsNodeModulesPath = path.join(modelsPath, 'node_modules');
console.log(`\nChecking @tufjs/models/node_modules directory: ${modelsNodeModulesPath}`);
console.log(` Exists: ${fs.existsSync(modelsNodeModulesPath)}`);
if (fs.existsSync(modelsNodeModulesPath)) {
const modelsNodeModulesContents = fs.readdirSync(modelsNodeModulesPath);
console.log(` Contents: [${modelsNodeModulesContents.join(', ')}]`);
const minimatchPath = path.join(modelsNodeModulesPath, 'minimatch');
console.log(`\nChecking minimatch directory: ${minimatchPath}`);
console.log(` Exists: ${fs.existsSync(minimatchPath)}`);
if (fs.existsSync(minimatchPath)) {
const minimatchContents = fs.readdirSync(minimatchPath);
console.log(` Contents: [${minimatchContents.join(', ')}]`);
const distPath = path.join(minimatchPath, 'dist');
console.log(`\nChecking dist directory: ${distPath}`);
console.log(` Exists: ${fs.existsSync(distPath)}`);
if (fs.existsSync(distPath)) {
const distContents = fs.readdirSync(distPath);
console.log(` Contents: [${distContents.join(', ')}]`);
const commonjsPath = path.join(distPath, 'commonjs');
console.log(`\nChecking commonjs directory: ${commonjsPath}`);
console.log(` Exists: ${fs.existsSync(commonjsPath)}`);
if (fs.existsSync(commonjsPath)) {
const commonjsContents = fs.readdirSync(commonjsPath);
console.log(` Contents: [${commonjsContents.join(', ')}]`);
const indexPath = path.join(commonjsPath, 'index.js');
console.log(`\nChecking index.js: ${indexPath}`);
console.log(` Exists: ${fs.existsSync(indexPath)}`);
if (fs.existsSync(indexPath)) {
const stats = fs.statSync(indexPath);
console.log(` Size: ${stats.size} bytes`);
}
}
}
}
}
}
}
}
// Check the critical file that's missing
const criticalPath = path.join(npmPath, 'node_modules', '@tufjs', 'models', 'node_modules', 'minimatch', 'dist', 'commonjs', 'index.js');
console.log(`\n=== Critical file check ===`);
console.log(`File: ${criticalPath}`);
console.log(`Exists: ${fs.existsSync(criticalPath)}`);
if (fs.existsSync(criticalPath)) {
const stats = fs.statSync(criticalPath);
console.log(`Size: ${stats.size} bytes`);
console.log('SUCCESS: Critical file exists!');
} else {
console.log('FAILURE: Critical file is MISSING!');
}
}
// Run the debug
const installPath = path.join(process.env.HOME, '.nvu', 'installed', 'v24.12.0');
if (fs.existsSync(installPath)) {
debugNvuInstallation(installPath);
} else {
console.log(`Installation directory not found: ${installPath}`);
process.exit(1);
}
EOF
echo "Running debug script..."
node debug-installation.cjs
- name: Test npm cache clean (should fail)
run: |
echo "Testing npm cache clean - this should fail..."
nvu 24 npm cache clean --force || echo "Expected failure occurred"