// Step 1: Import the 'fs' module
const fs = require('fs');
// Step 2: Specify the file path
const filePath = '/path/to/nonexistent/file.txt';
// Step 3: Use the 'readFileSync' function to read the file synchronously
try {
// Step 4: Attempt to read the file
const fileContent = fs.readFileSync(filePath, 'utf8');
// Step 5: If successful, log the file content
console.log('File content:', fileContent);
} catch (error) {
// Step 6: If an error occurs, catch it and log an error message
console.error('Error reading file:', error.message);
}