Skip to main content

❓ Troubleshooting & FAQ

Common issues, solutions, and frequently asked questions πŸ”§

This guide covers the most common issues developers encounter when working with Nodeblocks frontend components and their solutions.


πŸ“‹ Table of Contents​


🚨 Installation Issues​

Package Not Found Error​

Problem:

npm ERR! 404 Not Found - GET https://registry.npmjs.org/@nodeblocks%2ffrontend-navbar-block

Solutions:

  1. Check your .npmrc configuration:
# Verify .npmrc exists and has correct content
cat .npmrc
  1. Ensure token is set:
echo $NODEBLOCKS_DEV_TOKEN
  1. Verify registry configuration:
@nodeblocks:registry=https://registry.npmjs.org
@basaldev:registry=https://registry.npmjs.org
//registry.npmjs.org/:_authToken=${NODEBLOCKS_DEV_TOKEN}

Authentication Failed (401 Error)​

Problem:

npm ERR! 401 Unauthorized - GET https://registry.npmjs.org/@nodeblocks/...

Solutions:

  1. Check token validity:

    • Contact Nodeblocks team for a new token
    • Ensure token hasn't expired
  2. Verify environment variable:

# Linux/macOS
export NODEBLOCKS_DEV_TOKEN=your_actual_token_here

# Windows
set NODEBLOCKS_DEV_TOKEN=your_actual_token_here
  1. Clear npm cache:
npm cache clean --force

πŸ” Authentication & Registry​

Cannot Access Private Packages​

Problem: Getting 404 or access denied errors for @nodeblocks packages.

Checklist:

  1. βœ… .npmrc file exists in project root
  2. βœ… Registry configuration is correct
  3. βœ… NODEBLOCKS_DEV_TOKEN environment variable is set
  4. βœ… Token is valid and not expired
  5. βœ… You have access permissions

Quick Fix:

# Check current npm configuration
npm config list

# Verify nodeblocks registry setting
npm config get @nodeblocks:registry

Token Environment Variable Not Working​

Problem: Token set but still getting authentication errors.

Solutions:

  1. For current session:
# Linux/macOS
export NODEBLOCKS_DEV_TOKEN=your_token

# Windows Command Prompt
set NODEBLOCKS_DEV_TOKEN=your_token

# Windows PowerShell
$env:NODEBLOCKS_DEV_TOKEN="your_token"
  1. For permanent setup:
# Linux/macOS - Add to ~/.bashrc or ~/.zshrc
echo 'export NODEBLOCKS_DEV_TOKEN=your_token' >> ~/.bashrc

# Windows - Use System Environment Variables
  1. Verify token is loaded:
npm install --verbose

πŸ”§ Configuration Problems​

Environment Variables Not Working​

Problem: Service endpoints not being loaded from environment variables.

Framework-Specific Solutions:

Vite:

# Must start with VITE_
VITE_USER_SERVICE_URL=https://api.example.com
// Access in component
const userServiceUrl = import.meta.env.VITE_USER_SERVICE_URL;

Create React App:

# Must start with REACT_APP_
REACT_APP_USER_SERVICE_URL=https://api.example.com
// Access in component
const userServiceUrl = process.env.REACT_APP_USER_SERVICE_URL;

🎨 Theme Issues​

Components Not Styled Correctly (Missing ThemeProvider)​

Problem: Components render with incorrect or missing styles, wrong colors, or broken layouts.

Cause: The ThemeProvider is not wrapping your application.

Solution: Wrap your entire application with ThemeProvider:

// ❌ Wrong - No ThemeProvider
function App() {
return (
<div>
<Navbar ... />
<SignIn ... />
</div>
);
}

// βœ… Correct - ThemeProvider wraps everything
import { ThemeProvider } from '@nodeblocks/frontend-theme';

function App() {
return (
<ThemeProvider>
<div>
<Navbar ... />
<SignIn ... />
</div>
</ThemeProvider>
);
}

CSS Variables Not Working​

Problem: CSS variables like var(--mui-palette-primary-main) return undefined or don't work.

Cause: ThemeProvider is missing or cssVariables is disabled.

Solution:

  1. Ensure ThemeProvider wraps your app
  2. If using a custom theme, enable CSS variables:
import { createTheme } from '@mui/material/styles';
import { defaultTheme, ThemeProvider } from '@nodeblocks/frontend-theme';

const customTheme = createTheme(defaultTheme, {
cssVariables: true, // Must be enabled for CSS variables
palette: {
primary: { main: '#your-color' }
}
});

function App() {
return (
<ThemeProvider theme={customTheme}>
{/* Your app */}
</ThemeProvider>
);
}

Theme Customizations Not Applying​

Problem: Custom theme colors or typography aren't being applied to components.

Causes & Solutions:

  1. Not passing theme to ThemeProvider:
// ❌ Wrong - custom theme not passed
<ThemeProvider>

// βœ… Correct - pass your custom theme
<ThemeProvider theme={customTheme}>
  1. Overriding all defaults instead of extending:
// ❌ Wrong - loses all Nodeblocks defaults
const customTheme = createTheme({
palette: { primary: { main: '#8B5CF6' } }
});

// βœ… Correct - extends defaultTheme
import { defaultTheme } from '@nodeblocks/frontend-theme';

const customTheme = createTheme(defaultTheme, {
palette: { primary: { main: '#8B5CF6' } }
});
  1. Not spreading nested defaults:
// ❌ Wrong - loses primary.contrastText, primary.light, etc.
palette: {
primary: { main: '#8B5CF6' }
}

// βœ… Correct - preserves all primary properties
import { palette as defaultPalette } from '@nodeblocks/frontend-theme';

palette: {
...defaultPalette,
primary: { ...defaultPalette.primary, main: '#8B5CF6' }
}

πŸ“– See our Theming Guide for complete theming documentation.


πŸ–ŒοΈ Styling & UI Issues​

Components Look Different Than Expected​

Problem: Components don't match the expected design or documentation.

Solutions:

  1. Check for global CSS conflicts:
/* Your global styles might be interfering */
* {
box-sizing: border-box; /* This might affect component layouts */
}
  1. Use component-specific styling:
<SignIn
style={{
maxWidth: '400px',
margin: '0 auto',
padding: '2rem'
}}
>
{/* Component content */}
</SignIn>
  1. When components don't accept styles:
/* Use higher specificity to override component styles */
#root .your-component-class {
/* Your custom styles here */
background-color: #f5f5f5;
border-radius: 8px;
padding: 1rem;
}

/* For more specific overrides, use multiple selectors */
#root .product-grid .product-item {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
transition: transform 0.2s ease;
}

❓ Frequently Asked Questions​

General Questions​

Q: Do I need to install all components? A: No! Install only the components you need. Each component is a separate package.

Q: Can I customize the styling? A: Absolutely! Components accept sx prop for MUI styling, and can be themed globally. See our Theming Guide.

Q: Why do my components look unstyled? A: Make sure your app is wrapped with ThemeProvider from @nodeblocks/frontend-theme. See Theme Issues.

Technical Questions​

Q: Do Nodeblocks work with TypeScript? A: Yes, all components include TypeScript definitions.

Q: Can I use Nodeblocks with state management libraries like Redux? A: Yes, but the Domain App provides built-in state management. You can integrate with external state if needed.

Q: How do I handle form validation? A: Use the onChange prop with setError, getValues, and clearErrors functions.

Q: Can I override component behavior? A: Yes, for example using the block overriding pattern. See our Advanced Usage Guide.


Having a different issue? Contact our support team with details about your specific problem.